|
98f53872
|
2017-01-21T18:57:28
|
|
Merge pull request #4016 from novalis/submodule-optimization
Submodule optimization
|
|
52949c80
|
2017-01-21T18:30:12
|
|
Merge branch 'pr/4060'
|
|
4d99c4cf
|
2016-11-23T18:32:48
|
|
Allow for caching of submodules.
Added `git_repository_submodule_cache_all` to initialze a cache of
submodules on the repository so that operations looking up N
submodules are O(N) and not O(N^2). Added a
`git_repository_submodule_cache_clear` function to remove the cache.
Also optimized the function that loads all submodules as it was itself
O(N^2) w.r.t the number of submodules, having to loop through the
`.gitmodules` file once per submodule. I changed it to process the
`.gitmodules` file once, into a map.
Signed-off-by: David Turner <dturner@twosigma.com>
|
|
cb76eed5
|
2017-01-14T17:41:49
|
|
Merge pull request #4054 from jfultz/jfultz/fix_GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH
Fix handling of GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH flag.
|
|
2854e619
|
2017-01-14T17:12:23
|
|
Merge pull request #4061 from libgit2/ethomson/merge_opts
merge: set default rename threshold
|
|
f5586f5c
|
2017-01-14T16:37:00
|
|
Addressed review feedback
|
|
a6d833a2
|
2017-01-13T17:05:58
|
|
Merge pull request #4049 from libgit2/ethomson/error_msgs
giterr_set: consistent error messages
|
|
2ac57aa8
|
2017-01-09T17:53:21
|
|
https: don't test that RC4 is invalid
None of our crypto backends actually reject RC4 as a cipher so don't
test for it and instead keep it as something we'd like to do.
|
|
3829ba2e
|
2017-01-09T17:50:17
|
|
http: correct the expected error for RC4
We must make sure that we're getting a certificate error from the
library so we know that we're testing the right thing.
|
|
98d66240
|
2017-01-06T10:51:31
|
|
http: perform 'badssl' check also via certificate callback
Make sure that the callbacks do also get a 'valid' value of zero when
the certificate we're looking at is in valid and assert that within the
test.
|
|
a7ff6e5e
|
2017-01-03T18:24:51
|
|
Fix the memory leak
|
|
def644e4
|
2017-01-01T17:35:29
|
|
Add a test
|
|
19ed4d0c
|
2017-01-01T22:19:23
|
|
merge: set default rename threshold
When `GIT_MERGE_FIND_RENAMES` is set, provide a default for
`rename_threshold` when it is unset.
|
|
5f959dca
|
2016-12-29T19:26:50
|
|
Fix handling of GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH flag.
git_checkout_tree() sets up its working directory iterator to respect the
pathlist if GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH is present, which is great.
What's not so great is that this iterator is then used side-by-side with
an iterator created by git_checkout_iterator(), which did not set up its
pathlist appropriately (although the iterator mirrors all other iterator
options).
This could cause git_checkout_tree() to delete working tree files which
were not specified in the pathlist when GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH
was used, as the unsynchronized iterators causes git_checkout_tree() to think
that files have been deleted between the two trees. Oops.
And added a test which fails without this fix (specifically, the final check
for "testrepo/README" to still be present fails).
|
|
8f0d5cde
|
2016-12-29T12:55:49
|
|
tests: update error message checking
|
|
8d7717c4
|
2016-12-20T15:32:49
|
|
Merge pull request #4034 from libgit2/cmn/sysdir-no-reguess
sysdir: don't re-guess when using variable substitution
|
|
410855fc
|
2016-12-17T18:18:30
|
|
sysdir: add failing test for variable substitution
When given $PATH as part of a search path, we guess again instead of
substituting what the user already set.
|
|
f7dcd58c
|
2016-12-17T00:55:06
|
|
rebase: plug a leak in the tests
|
|
c5e6ba28
|
2016-12-15T18:19:49
|
|
Merge pull request #4029 from libgit2/cmn/windows-no-concurrent-compress
refdb: disable concurrent compress in the threading tests on Windows
|
|
b31283a6
|
2016-12-12T17:09:12
|
|
refdb: disable concurrent compress in the threading tests on Windows
This is far from an ideal situation, but this causes issues on Windows which
make it harder to develop anything, as these tests hit issues which relate
specifically to the Windows filesystem like permission errors for files we
should be able to access. There is an issue likely related to the ordering of
the repack, but there's enough noise that it does not currently help us to run
this aspect of the test in CI.
|
|
ab0cc5a0
|
2016-11-25T14:58:16
|
|
clar: mark `cl_git_thread_check()` as inline
The function `cl_git_thread_check()` is defined as static. As the
function is defined in a header file which is included by our
tests, this can result in warnings for every test file where
`cl_git_thread_check` is never used.
Fix the issue by marking it as inline instead.
|
|
4db1fc7e
|
2016-12-01T23:06:41
|
|
git_rebase_init: correctly handle detached HEAD
git_rebase_finish relies on head_detached being set, but
rebase_init_merge was only setting it when branch->ref_name was unset.
But branch->ref_name would be set to "HEAD" in the case of detached
HEAD being either implicitly (NULL) or explicitly passed to
git_rebase_init.
|
|
6367c58c
|
2016-11-18T18:30:20
|
|
tests: handle life without threads
|
|
6a05c7a0
|
2016-11-18T07:37:47
|
|
threads::refdb tests: use new threaded clar assert
|
|
bbf22f82
|
2016-11-18T07:34:20
|
|
clar: Introduce assertion helpers for threads
Don't `cl_git_pass` in a child thread. When the assertion fails, clar
will `longjmp` to its error handler, but:
> The effect of a call to longjmp() where initialization of the jmp_buf
> structure was not performed in the calling thread is undefined.
Instead, set up an error context that threads can populate, and the
caller can check.
|
|
99479062
|
2016-11-18T16:50:34
|
|
core::init tests: reverse init/shutdown
We want a predictable number of initializations in our multithreaded
init test, but we also want to make sure that we have _actually_
initialized `git_libgit2_init` before calling `git_thread_create` (since
it now has a sanity check that `git_libgit2_init` has been called).
Since `git_thread_create` is internal-only, keep this sanity check.
Flip the invocation so that we `git_libgit2_init` before our thread
tests and `git_libgit2_shutdown` again after.
|
|
82f15896
|
2016-11-18T07:19:22
|
|
threads: introduce `git_thread_exit`
Introduce `git_thread_exit`, which will allow threads to terminate at an
arbitrary time, returning a `void *`. On Windows, this means that we
need to store the current `git_thread` in TLS, so that we can set its
`return` value when terminating.
We cannot simply use `ExitThread`, since Win32 returns `DWORD`s from
threads; we return `void *`.
|
|
a39f18ac
|
2016-11-14T17:10:43
|
|
Merge pull request #3998 from pks-t/pks/repo-discovery
Repository discovery starting from files
|
|
df045cef
|
2016-11-14T12:12:38
|
|
Merge pull request #4003 from libgit2/cmn/tree-updater-ordering
Use the sorted input in the tree updater
|
|
1d41b86c
|
2016-11-14T12:22:20
|
|
tree: add a failing test for unsorted input
We do not currently use the sorted version of this input in the
function, which means we produce bad results.
|
|
aef54a46
|
2016-11-14T11:29:40
|
|
refdb: use a constant for the number of per-thread creations/deletes
|
|
ce5553d4
|
2016-03-10T22:01:09
|
|
refdb: bubble up locked files on the read side
On Windows we can find locked files even when reading a reference or the
packed-refs file. Bubble up the error in this case as well to allow
callers on Windows to retry more intelligently.
|
|
7c32d874
|
2016-03-10T12:27:07
|
|
refdb: expect threaded test deletes to race
At times we may try to delete a reference which a different thread has
already taken care of.
|
|
26416f6d
|
2015-12-24T17:51:19
|
|
refdb: add retry logic to the threaded tests
The logic simply consists of retrying for as long as the library says
the data is locked, but it eventually gets through.
|
|
7da4c429
|
2015-12-24T12:37:41
|
|
refdb: adjust the threading tests to what we promise
We say it's going to work if you use a different repository in each
thread. Let's do precisely that in our code instead of hoping re-using
the refdb is going to work.
This test does fail currently, surfacing existing bugs.
|
|
0f316096
|
2016-11-11T16:55:33
|
|
repository: do not interpret all files as gitlinks in discovery
When trying to find a discovery, we walk up the directory
structure checking if there is a ".git" file or directory and, if
so, check its validity. But in the case that we've got a ".git"
file, we do not want to unconditionally assume that the file is
in fact a ".git" file and treat it as such, as we would error out
if it is not.
Fix the issue by only treating a file as a gitlink file if it
ends with "/.git". This allows users of the function to discover
a repository by handing in any path contained inside of a git
repository.
|
|
4dbaf3cd
|
2016-11-14T10:52:37
|
|
test: discover: fix indentation
|
|
5242c424
|
2016-11-11T16:43:37
|
|
test: discover: split up monolithic test into smaller ones
|
|
07afeb23
|
2016-11-11T16:16:34
|
|
test: discover: pass constants to ensure_repository_discover
|
|
2382b0f8
|
2016-11-11T15:50:14
|
|
test: discover: move layout creation into test initializer
|
|
5fe5557e
|
2016-11-04T18:18:46
|
|
Merge pull request #3974 from libgit2/pks/synchronize-shutdown
global: synchronize initialization and shutdown with pthreads
|
|
6e2fab9e
|
2016-11-04T18:14:00
|
|
Merge pull request #3977 from jfultz/fix-forced-branch-creation-on-bare-repo
|
|
f9793884
|
2016-10-28T14:32:01
|
|
branch: fix forced branch creation on HEAD of a bare repo
The code correctly detects that forced creation of a branch on a
nonbare repo should not be able to overwrite a branch which is
the HEAD reference. But there's no reason to prevent this on
a bare repo, and in fact, git allows this. I.e.,
git branch -f master new_sha
works on a bare repo with HEAD set to master. This change fixes
that problem, and updates tests so that, for this case, both the
bare and nonbare cases are checked for correct behavior.
|
|
1c33ecc4
|
2016-11-01T14:30:38
|
|
tests: core: test deinitialization and concurrent initialization
Exercise the logic surrounding deinitialization of the libgit2
library as well as repeated concurrent de- and reinitialization.
This tries to catch races and makes sure that it is possible to
reinitialize libgit2 multiple times.
After deinitializing libgit2, we have to make sure to setup
options required for testing. Currently, this only includes
setting up the configuration search path again. Before, this has
been set up once in `tests/main.c`.
|
|
95fa3880
|
2016-10-28T16:07:40
|
|
pqueue: resolve possible NULL pointer dereference
The `git_pqueue` struct allows being fixed in its total number of
entries. In this case, we simply throw away items that are
inserted into the priority queue by examining wether the new item
to be inserted has a higher priority than the previous smallest
one.
This feature somewhat contradicts our pqueue implementation in
that it is allowed to not have a comparison function. In fact, we
also fail to check if the comparison function is actually set in
the case where we add a new item into a fully filled fixed-size
pqueue.
As we cannot determine which item is the smallest item in absence
of a comparison function, we fix the `NULL` pointer dereference
by simply dropping all new items which are about to be inserted
into a full fixed-size pqueue.
|
|
30a876cd
|
2016-10-27T11:29:15
|
|
tests: fetchhead: fix memory leak
|
|
61ad9bcd
|
2016-10-27T11:26:52
|
|
tests: vector: fix memory leak
|
|
610cff13
|
2016-10-09T16:05:48
|
|
Merge branch 'pr/3809'
|
|
dc5cfdba
|
2016-06-02T23:18:31
|
|
make git_diff_stats_to_buf not show 0 insertions or 0 deletions
|
|
36117978
|
2016-10-06T18:30:30
|
|
Fix the existence check for `regcomp_l`.
`xlocale.h` only defines `regcomp_l` if `regex.h` was included as well.
Also change the test cases to actually test `p_regcomp` works with
a multibyte locale.
|
|
45dc219f
|
2016-10-07T16:01:28
|
|
Merge pull request #3921 from libgit2/cmn/walk-limit-enough
Improve revision walk preparation logic
|
|
ab96ca55
|
2016-10-06T13:15:31
|
|
Make sure we use the `C` locale for `regcomp` on macOS.
|
|
48c64362
|
2016-09-27T11:59:24
|
|
revwalk: port over the topological sorting
After porting over the commit hiding and selection we were still left
with mistmaching output due to the topologial sort.
This ports the topological sorting code to make us match with our
equivalent of `--date-order` and `--topo-order` against the output
from `rev-list`.
|
|
0bd43371
|
2016-09-23T12:42:33
|
|
vector, pqueue: add git_vector_reverse and git_pqueue_reverse
This is a convenience function to reverse the contents of a vector and a pqueue
in-place.
The pqueue function is useful in the case where we're treating it as a
LIFO queue.
|
|
6708618c
|
2016-07-21T01:24:12
|
|
revwalk: get closer to git
We had some home-grown logic to figure out which objects to show during
the revision walk, but it was rather inefficient, looking over the same
list multiple times to figure out when we had run out of interesting
commits. We now use the lists in a smarter way.
We also introduce the slop mechanism to determine when to stpo
looking. When we run out of interesting objects, we continue preparing
the walk for another 5 rounds in order to make it less likely that we
miss objects in situations with complex graphs.
|
|
565fb8dc
|
2016-06-25T20:02:45
|
|
revwalk: introduce tests that hide old commits
Introduce some tests that show some commits, while hiding some commits
that have a timestamp older than the common ancestors of these two
commits.
|
|
9ad07fc0
|
2016-09-06T10:43:21
|
|
Merge pull request #3923 from libgit2/ethomson/diff-read-empty-binary
Read binary patches (with no binary data)
|
|
46035d98
|
2016-09-06T11:21:29
|
|
Merge pull request #3882 from pks-t/pks/fix-fetch-refspec-dst-parsing
refspec: do not set empty rhs for fetch refspecs
|
|
adedac5a
|
2016-09-02T02:03:45
|
|
diff: treat binary patches with no data special
When creating and printing diffs, deal with binary deltas that have
binary data specially, versus diffs that have a binary file but lack the
actual binary data.
|
|
40b08124
|
2016-08-30T12:11:02
|
|
Merge pull request #3915 from pks-t/pks/index-collision-test-leak
tests: index: do not re-allocate index
|
|
88cfe614
|
2016-08-24T01:20:39
|
|
git_checkout_tree options fix
According to the reference the git_checkout_tree and git_checkout_head
functions should accept NULL in the opts field
This was broken since the opts field was dereferenced and thus lead to a
crash.
|
|
86e88534
|
2016-08-29T13:09:58
|
|
tests: index: do not re-allocate index
Plug a memory leak caused by re-allocating a `git_index`
structure which has already been allocated by the test suite's
initializer.
|
|
b859faa6
|
2016-08-23T23:38:39
|
|
Teach `git_patch_from_diff` about parsed diffs
Ensure that `git_patch_from_diff` can return the patch for parsed diffs,
not just generate a patch for a generated diff.
|
|
c1b370e9
|
2016-08-17T09:24:44
|
|
Merge pull request #3837 from novalis/dturner/indexv4
Support index v4
|
|
635a9222
|
2016-08-17T08:54:48
|
|
Merge pull request #3895 from pks-t/pks/negate-basename-in-subdirs
ignore: allow unignoring basenames in subdirectories
|
|
fcb2c1c8
|
2016-08-12T09:06:15
|
|
ignore: allow unignoring basenames in subdirectories
The .gitignore file allows for patterns which unignore previous
ignore patterns. When unignoring a previous pattern, there are
basically three cases how this is matched when no globbing is
used:
1. when a previous file has been ignored, it can be unignored by
using its exact name, e.g.
foo/bar
!foo/bar
2. when a file in a subdirectory has been ignored, it can be
unignored by using its basename, e.g.
foo/bar
!bar
3. when all files with a basename are ignored, a specific file
can be unignored again by specifying its path in a
subdirectory, e.g.
bar
!foo/bar
The first problem in libgit2 is that we did not correctly treat
the second case. While we verified that the negative pattern
matches the tail of the positive one, we did not verify if it
only matches the basename of the positive pattern. So e.g. we
would have also negated a pattern like
foo/fruz_bar
!bar
Furthermore, we did not check for the third case, where a
basename is being unignored in a certain subdirectory again.
Both issues are fixed with this commit.
|
|
5625d86b
|
2016-05-17T15:40:32
|
|
index: support index v4
Support reading and writing index v4. Index v4 uses a very simple
compression scheme for pathnames, but is otherwise similar to index v3.
Signed-off-by: David Turner <dturner@twitter.com>
|
|
aeb5ee5a
|
2016-05-17T15:40:46
|
|
varint: Add varint encoding/decoding
This code is ported from git.git
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Turner <dturner@twopensource.com>
|
|
5961face
|
2016-08-09T08:07:10
|
|
Merge pull request #3893 from pks-t/pks/remove-unused-test-cb
tests: blob: remove unused callback function
|
|
4006455f
|
2016-08-09T10:09:23
|
|
tests: blob: remove unused callback function
|
|
9bc8c80f
|
2016-08-05T20:34:19
|
|
odb: actually insert the empty blob in tests
|
|
becadafc
|
2016-08-05T19:30:56
|
|
odb: only provide the empty tree
Only provide the empty tree internally, which matches git's behavior.
If we provide the empty blob then any users trying to write it with
libgit2 would omit it from actually landing in the odb, which appear
to git proper as a broken repository (missing that object).
|
|
c550c922
|
2016-08-05T18:24:28
|
|
Merge pull request #3881 from pks-t/pks/fix-clar-suite-prefix-computation
clar: fix parsing of test suite prefixes
|
|
27051d4e
|
2016-07-22T13:34:19
|
|
odb: only freshen pack files every 2 seconds
Since writing multiple objects may all already exist in a single
packfile, avoid freshening that packfile repeatedly in a tight loop.
Instead, only freshen pack files every 2 seconds.
|
|
8f09a98e
|
2016-07-14T16:23:24
|
|
odb: freshen existing objects when writing
When writing an object, we calculate its OID and see if it exists in the
object database. If it does, we need to freshen the file that contains
it.
|
|
78b500bf
|
2016-08-04T12:45:19
|
|
Merge pull request #3850 from wildart/custom-tls
Enable https transport for custom TLS streams
|
|
1eee631d
|
2016-08-04T13:45:28
|
|
refspec: do not set empty rhs for fetch refspecs
According to git-fetch(1), "[t]he colon can be omitted when <dst>
is empty." So according to git, the refspec "refs/heads/master"
is the same as the refspec "refs/heads/master:" when fetching
changes. When trying to fetch from a remote with a trailing
colon with libgit2, though, the fetch actually fails while it
works when the trailing colon is left out. So obviously, libgit2
does _not_ treat these two refspec formats the same for fetches.
The problem results from parsing refspecs, where the resulting
refspec has its destination set to an empty string in the case of
a trailing colon and to a `NULL` pointer in the case of no
trailing colon. When passing this to our DWIM machinery, the
empty string gets translated to "refs/heads/", which is simply
wrong.
Fix the problem by having the parsing machinery treat both cases
the same for fetch refspecs.
|
|
f2cab0a6
|
2016-08-04T11:49:39
|
|
clar: fix parsing of test suite prefixes
When passing in a specific suite which should be executed by clar
via `-stest::suite`, we try to parse this string and then include
all tests contained in this suite. This also includes all tests
in sub-suites, e.g. 'test::suite::foo'.
In the case where multiple suites start with the same _string_,
for example 'test::foo' and 'test::foobar', we fail to
distinguish this correctly. When passing in `-stest::foobar`,
we wrongly determine that 'test::foo' is a prefix and try to
execute all of its matching functions. But as no function
will now match 'test::foobar', we simply execute nothing.
To fix this, we instead have to check if the prefix is an actual
suite prefix as opposed to a simple string prefix. We do so by by
inspecting if the first two characters trailing the prefix are
our suite delimiters '::', and only consider the filter as
matching in this case.
|
|
498d0801
|
2016-07-22T12:01:24
|
|
tests: use a `size_t`
|
|
e02f5676
|
2016-07-15T12:43:57
|
|
repo::open: remove dead code, free buffers
|
|
bdec62dc
|
2016-07-06T13:06:25
|
|
remove conditions that prevent use of custom TLS stream
|
|
c18a2bc4
|
2016-07-05T15:51:01
|
|
Merge pull request #3851 from txdv/get-user-agent
Add get user agent functionality.
|
|
b57c176a
|
2016-07-05T12:46:27
|
|
Merge pull request #3846 from rkrp/fix_bug_parsing_int64min
Fixed bug while parsing INT64_MIN
|
|
f1dba144
|
2016-07-05T09:41:51
|
|
Add get user agent functionality.
|
|
ebeb56f0
|
2016-07-01T18:45:10
|
|
Merge pull request #3711 from joshtriplett/git_repository_discover_default
Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars
|
|
6249d960
|
2016-06-29T17:55:44
|
|
index: include conflicts in `git_index_read_index`
Ensure that we include conflicts when calling `git_index_read_index`,
which will remove conflicts in the index that do not exist in the new
target, and will add conflicts from the new target.
|
|
70b9b841
|
2016-06-28T20:19:52
|
|
Fixed bug while parsing INT64_MIN
|
|
20302aa4
|
2016-06-25T23:33:05
|
|
Merge pull request #3223 from ethomson/apply
Reading patch files
|
|
1a79cd95
|
2016-04-26T01:18:01
|
|
patch: show copy information for identical copies
When showing copy information because we are duplicating contents,
for example, when performing a `diff --find-copies-harder -M100 -B100`,
then show copy from/to lines in a patch, and do not show context.
Ensure that we can also parse such patches.
|
|
9eb19381
|
2016-04-25T22:35:55
|
|
patch::parse: test diff with exact rename and copy
|
|
8a670dc4
|
2016-04-25T18:08:03
|
|
patch::parse: test diff with simple rename
|
|
e774d5af
|
2016-04-25T16:47:48
|
|
diff::parse tests: test parsing a diff
Test that we can create a diff file, then parse the results and
that the two are identical in-memory.
|
|
0dd98b69
|
2016-04-03T17:22:07
|
|
Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars
git_repository_open_ext provides parameters for the start path, whether
to search across filesystems, and what ceiling directories to stop at.
git commands have standard environment variables and defaults for each
of those, as well as various other parameters of the repository. To
avoid duplicate environment variable handling in users of libgit2, add a
GIT_REPOSITORY_OPEN_FROM_ENV flag, which makes git_repository_open_ext
automatically handle the appropriate environment variables. Commands
that intend to act just like those built into git itself can use this
flag to get the expected default behavior.
git_repository_open_ext with the GIT_REPOSITORY_OPEN_FROM_ENV flag
respects $GIT_DIR, $GIT_DISCOVERY_ACROSS_FILESYSTEM,
$GIT_CEILING_DIRECTORIES, $GIT_INDEX_FILE, $GIT_NAMESPACE,
$GIT_OBJECT_DIRECTORY, and $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the
future, when libgit2 gets worktree support, git_repository_open_env will
also respect $GIT_WORK_TREE and $GIT_COMMON_DIR; until then,
git_repository_open_ext with this flag will error out if either
$GIT_WORK_TREE or $GIT_COMMON_DIR is set.
|
|
39c6fca3
|
2016-04-03T16:01:01
|
|
Add GIT_REPOSITORY_OPEN_NO_DOTGIT flag to avoid appending /.git
GIT_REPOSITORY_OPEN_NO_SEARCH does not search up through parent
directories, but still tries the specified path both directly and with
/.git appended. GIT_REPOSITORY_OPEN_BARE avoids appending /.git, but
opens the repository in bare mode even if it has a working directory.
To support the semantics git uses when given $GIT_DIR in the
environment, provide a new GIT_REPOSITORY_OPEN_NO_DOTGIT flag to not try
appending /.git.
|
|
ed577134
|
2016-04-03T19:24:15
|
|
Fix repository discovery with ceiling_dirs at current directory
git only checks ceiling directories when its search ascends to a parent
directory. A ceiling directory matching the starting directory will not
prevent git from finding a repository in the starting directory or a
parent directory. libgit2 handled the former case correctly, but
differed from git in the latter case: given a ceiling directory matching
the starting directory, but no repository at the starting directory,
libgit2 would stop the search at that point rather than finding a
repository in a parent directory.
Test case using git command-line tools:
/tmp$ git init x
Initialized empty Git repository in /tmp/x/.git/
/tmp$ cd x/
/tmp/x$ mkdir subdir
/tmp/x$ cd subdir/
/tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x git rev-parse --git-dir
fatal: Not a git repository (or any of the parent directories): .git
/tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x/subdir git rev-parse --git-dir
/tmp/x/.git
Fix the testsuite to test this case (in one case fixing a test that
depended on the current behavior), and then fix find_repo to handle this
case correctly.
In the process, simplify and document the logic in find_repo():
- Separate the concepts of "currently checking a .git directory" and
"number of iterations left before going further counts as a search"
into two separate variables, in_dot_git and min_iterations.
- Move the logic to handle in_dot_git and append /.git to the top of the
loop.
- Only search ceiling_dirs and find ceiling_offset after running out of
min_iterations; since ceiling_offset only tracks the longest matching
ceiling directory, if ceiling_dirs contained both the current
directory and a parent directory, this change makes find_repo stop the
search at the parent directory.
|
|
fe345c73
|
2016-02-09T12:29:31
|
|
Remove unused static functions
|
|
8fd74c08
|
2016-02-09T12:18:28
|
|
Avoid old-style function definitions
Avoid declaring old-style functions without any parameters.
Functions not accepting any parameters should be declared with
`void fn(void)`. See ISO C89 $3.5.4.3.
|
|
faebc1c6
|
2016-06-20T17:44:04
|
|
threads: split up OS-dependent thread code
|
|
bb0bd71a
|
2016-06-15T15:47:28
|
|
checkout: use empty baseline when no index
When no index file exists and a baseline is not explicitly provided, use
an empty baseline instead of trying to load `HEAD`.
|
|
292c6027
|
2016-06-07T12:29:16
|
|
tests: fix memory leaks in checkout::typechange
|