| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
- Hide the remaining transports code
- Drop `git_headarray`, switch to using a callback to list refs. Makes
the code cleaner.
|
|
|
|
| |
Thanks @carlosmn!
|
| |
|
| |
|
|
|
|
|
| |
There's no difference between `_free` and `_close` semantics: keep
everything with the same name to avoid confusions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ownership semantics have been changed all over the library to be
consistent. There are no more "borrowed" or duplicated references.
Main changes:
- `git_repository_open2` and `3` have been dropped.
- Added setters and getters to hotswap all the repository owned
objects:
`git_repository_index`
`git_repository_set_index`
`git_repository_odb`
`git_repository_set_odb`
`git_repository_config`
`git_repository_set_config`
`git_repository_workdir`
`git_repository_set_workdir`
Now working directories/index files/ODBs and so on can be
hot-swapped after creating a repository and between operations.
- All these objects now have proper ownership semantics with
refcounting: they all require freeing after they are no longer
needed (the repository always keeps its internal reference).
- Repository open and initialization has been updated to keep in
mind the configuration files. Bare repositories are now always
detected, and a default config file is created on init.
- All the tests affected by these changes have been dropped from the
old test suite and ported to the new one.
|
|\
| |
| | |
Don't fail when opening a new config file
|
| | |
|
|\ \
| |/
|/| |
reference_rename() cleanup
|
| |
| |
| |
| |
| |
| |
| |
| | |
reference_rename used to delete an old reflog file when renaming a
reference to not confuse git.git. Don't do this anymore but let the user
take care of writing a reflog entry.
Signed-off-by: schu <schu-github@schulog.org>
|
| |
| |
| |
| | |
Signed-off-by: schu <schu-github@schulog.org>
|
| |
| |
| |
| |
| |
| |
| | |
Actually rollback when we can't create the new reference. Mark the
rolled back reference as loose.
Signed-off-by: schu <schu-github@schulog.org>
|
| |
| |
| |
| |
| |
| |
| | |
0c49ec2 replaced git_futils_mv_atomic with p_rename without removing its
prototype.
Signed-off-by: schu <schu-github@schulog.org>
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Networking improvements
|
| | |
| | |
| | |
| | | |
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It can be useful to separate disconnecting from actually destroying
the object.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A simple branchname as refspec is valid and we shouldn't throw an
error when encountering one.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Add a next pointer to make it a linked list and add the 'pattern' and
'matching' flags.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| | |
| | |
| | |
| | |
| | |
| | | |
Make it a bit more resilient.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
There is no good reason to expose the negotiation as a different step
to downloading the packfile.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| |/ |
|
|/
|
|
|
|
|
|
| |
Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT
and make git_filebuf_open and git_filebuf_cleanup safe to be called
multiple times on the same buffer.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
|
|
|
|
|
| |
It's redundant to do this (git doesn't) and Windows doesn't allow us
to overwrite a read-only file (which objects are).
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| |
|
|
|
|
| |
That makes more sense to me.
|
|
|
|
|
| |
This groups the #define with the other ref-related file modes, and it
makes the name consistent with the other packed-refs definitions.
|
|
|
|
| |
This matches stock Git's behavior.
|
|
|
|
|
|
|
| |
See `global.c` for a description of what we're doing.
When libgit2 is built with GIT_THREADS support, the threading system
must be explicitly initialized with `git_threads_init()`.
|
|
|
|
| |
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
|
|
| |
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
|
|
|
|
| |
Move the callers of git_futils_mv_atomic to use p_rename.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new version of the references code is significantly faster and
hopefully easier to read.
External API stays the same. A new method `git_reference_reload()` has
been added to force updating a memory reference from disk. In-memory
references are no longer updated automagically -- this was killing us.
If a reference is deleted externally and the user doesn't reload the
memory object, nothing critical happens: any functions using that
reference should fail gracefully (e.g. deletion, renaming, and so on).
All generated references from the API are read only and must be free'd
by the user. There is no reference counting and no traces of generated
references are kept in the library.
There is no longer an internal representation for references. There is
only one reference struct `git_reference`, and symbolic/oid targets are
stored inside an union.
Packfile references are stored using an optimized struct with flex array
for reference names. This should significantly reduce the memory cost of
loading the packfile from disk.
|
|
|
|
|
|
|
|
|
| |
git_reference_rename() didn't properly cleanup old references given by
the user to not break some ugly old tests. Since references don't point
to libgit's internal cache anymore we can cleanup git_reference_rename()
to be somewhat less messy.
Signed-off-by: schu <schu-github@schulog.org>
|
|
|
|
|
|
|
| |
Since references are not owned by the repository anymore we have to free
them manually now.
Signed-off-by: schu <schu-github@schulog.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently libgit2 shares pointers to its internal reference cache with
the user. This leads to several problems like invalidation of reference
pointers when reordering the cache or manipulation of the cache from
user side.
Give each user its own git_reference instead of leaking the internal
representation (struct reference).
Add the following new API functions:
* git_reference_free
* git_reference_is_packed
Signed-off-by: schu <schu-github@schulog.org>
|
|\
| |
| | |
Status: fix segfault (#465) and order issues
|
| |
| |
| |
| |
| |
| |
| | |
This ensures that entries from the working directory are retrieved according to the following rules:
- The file "subdir" should appear before the file "subdir.txt"
- The folder "subdir" should appear after the file "subdir.txt"
|
| |
| |
| |
| | |
Fixes #465
|
|\ \
| |/
|/| |
Create objects, indexes, and directories with the right file permissions
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The following files now have 0444 permissions:
- loose objects
- pack indexes
- pack files
- packs downloaded by fetch
- packs downloaded by the HTTP transport
And the following files now have 0666 permissions:
- config files
- repository indexes
- reflogs
- refs
This brings libgit2 more in line with Git.
Note that git_filebuf_commit() and git_filebuf_commit_at() have both
gained a new mode parameter.
The latter change fixes an important issue where filebufs created with
GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3)
usage). Now we chmod() the file before renaming it into place.
Tests have been added to confirm that new commit, tag, and tree
objects are created with the right permissions. I don't have access to
Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To further match how Git behaves, this change makes most of the
directories libgit2 creates in a git repo have a file mode of
0777. Specifically:
- Intermediate directories created with git_futils_mkpath2file() have
0777 permissions. This affects odb_loose, reflog, and refs.
- The top level folder for bare repos is created with 0777
permissions.
- The top level folder for non-bare repos is created with 0755
permissions.
- /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are
created with 0777 permissions.
Additionally, the following changes have been made:
- fileops functions that create intermediate directories have grown a
new dirmode parameter. The only exception to this is filebuf's
lock_file(), which unconditionally creates intermediate directories
with 0777 permissions when GIT_FILEBUF_FORCE is set.
- The test runner now sets the umask to 0 before running any
tests. This ensurses all file mode checks are consistent across
systems.
- t09-tree.c now does a directory permissions check. I've avoided
adding this check to other tests that might reuse existing
directories from the prefabricated test repos. Because they're
checked into the repo, they have 0755 permissions.
- Other assorted directories created by tests have 0777 permissions.
|
| |
| |
| |
| |
| | |
Note: Functions exported from fileops take const mode_t, while the
underlying POSIX wrappers take mode_t.
|
| |
| |
| |
| |
| | |
Ensure that all memory related functions (malloc, calloc, strdup, free,
etc) are using their respective `git__` wrappers.
|
| | |
|
|\ \ |
|