summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4029 from libgit2/cmn/windows-no-concurrent-compressv0.24.4Edward Thomson2016-12-151-2/+8
|\ | | | | refdb: disable concurrent compress in the threading tests on Windows
| * refdb: disable concurrent compress in the threading tests on Windowscmn/windows-no-concurrent-compressCarlos Martín Nieto2016-12-121-2/+8
| | | | | | | | | | | | | | | | | | 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.
* | clar: mark `cl_git_thread_check()` as inlinePatrick Steinhardt2016-12-121-1/+1
|/ | | | | | | | | 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.
* git_rebase_init: correctly handle detached HEADDavid Turner2016-12-011-0/+53
| | | | | | | | 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.
* tests: handle life without threadsethomson/clar_threadsEdward Thomson2016-11-182-2/+12
|
* threads::refdb tests: use new threaded clar assertEdward Thomson2016-11-181-10/+14
|
* clar: Introduce assertion helpers for threadsEdward Thomson2016-11-181-0/+41
| | | | | | | | | | | 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.
* core::init tests: reverse init/shutdownEdward Thomson2016-11-181-2/+2
| | | | | | | | | | | 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.
* threads: introduce `git_thread_exit`Edward Thomson2016-11-181-0/+27
| | | | | | | | | | 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 *`.
* Merge pull request #3998 from pks-t/pks/repo-discoveryCarlos Martín Nieto2016-11-141-56/+104
|\ | | | | Repository discovery starting from files
| * repository: do not interpret all files as gitlinks in discoveryPatrick Steinhardt2016-11-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * test: discover: fix indentationPatrick Steinhardt2016-11-141-1/+1
| |
| * test: discover: split up monolithic test into smaller onesPatrick Steinhardt2016-11-141-49/+67
| |
| * test: discover: pass constants to ensure_repository_discoverPatrick Steinhardt2016-11-141-19/+26
| |
| * test: discover: move layout creation into test initializerPatrick Steinhardt2016-11-141-22/+35
| |
* | Merge pull request #4003 from libgit2/cmn/tree-updater-orderingEdward Thomson2016-11-141-0/+57
|\ \ | | | | | | Use the sorted input in the tree updater
| * | tree: add a failing test for unsorted inputCarlos Martín Nieto2016-11-141-0/+57
| |/ | | | | | | | | We do not currently use the sorted version of this input in the function, which means we produce bad results.
* | refdb: use a constant for the number of per-thread creations/deletescmn/refdb-paraCarlos Martín Nieto2016-11-141-6/+8
| |
* | refdb: bubble up locked files on the read sideCarlos Martín Nieto2016-11-141-4/+13
| | | | | | | | | | | | 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.
* | refdb: expect threaded test deletes to raceCarlos Martín Nieto2016-11-141-0/+4
| | | | | | | | | | At times we may try to delete a reference which a different thread has already taken care of.
* | refdb: add retry logic to the threaded testsCarlos Martín Nieto2016-11-141-5/+13
| | | | | | | | | | The logic simply consists of retrying for as long as the library says the data is locked, but it eventually gets through.
* | refdb: adjust the threading tests to what we promiseCarlos Martín Nieto2016-11-141-78/+44
|/ | | | | | | | 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.
* Merge pull request #3974 from libgit2/pks/synchronize-shutdownPatrick Steinhardt2016-11-041-0/+40
|\ | | | | global: synchronize initialization and shutdown with pthreads
| * tests: core: test deinitialization and concurrent initializationpks/synchronize-shutdownPatrick Steinhardt2016-11-021-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | 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`.
* | Merge pull request #3977 from jfultz/fix-forced-branch-creation-on-bare-repoPatrick Steinhardt2016-11-041-1/+25
|\ \
| * | branch: fix forced branch creation on HEAD of a bare repoJohn Fultz2016-11-041-1/+25
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | pqueue: resolve possible NULL pointer dereferencePatrick Steinhardt2016-10-281-0/+22
|/ | | | | | | | | | | | | | | | | | | 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.
* tests: fetchhead: fix memory leakPatrick Steinhardt2016-10-271-0/+2
|
* tests: vector: fix memory leakPatrick Steinhardt2016-10-271-0/+2
|
* Merge branch 'pr/3809'Edward Thomson2016-10-0911-3/+40
|\
| * make git_diff_stats_to_buf not show 0 insertions or 0 deletionsSim Domingo2016-10-0911-3/+40
| |
* | Fix the existence check for `regcomp_l`.Arthur Schreiber2016-10-071-7/+29
| | | | | | | | | | | | | | `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.
* | Merge pull request #3921 from libgit2/cmn/walk-limit-enoughEdward Thomson2016-10-0718-8/+100
|\ \ | | | | | | Improve revision walk preparation logic
| * | revwalk: port over the topological sortingCarlos Martín Nieto2016-10-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
| * | vector, pqueue: add git_vector_reverse and git_pqueue_reverseCarlos Martín Nieto2016-10-061-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | revwalk: get closer to gitCarlos Martín Nieto2016-10-063-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | revwalk: introduce tests that hide old commitsEdward Thomson2016-10-0615-4/+64
| | | | | | | | | | | | | | | | | | Introduce some tests that show some commits, while hiding some commits that have a timestamp older than the common ancestors of these two commits.
* | | Make sure we use the `C` locale for `regcomp` on macOS.Arthur Schreiber2016-10-061-1/+26
|/ /
* | Merge pull request #3923 from libgit2/ethomson/diff-read-empty-binaryEdward Thomson2016-09-062-0/+11
|\ \ | | | | | | Read binary patches (with no binary data)
| * | diff: treat binary patches with no data specialethomson/diff-read-empty-binaryEdward Thomson2016-09-052-0/+11
| | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #3882 from pks-t/pks/fix-fetch-refspec-dst-parsingPatrick Steinhardt2016-09-061-0/+51
|\ \ \ | |/ / |/| | refspec: do not set empty rhs for fetch refspecs
| * | refspec: do not set empty rhs for fetch refspecsPatrick Steinhardt2016-08-041-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #3915 from pks-t/pks/index-collision-test-leakCarlos Martín Nieto2016-08-301-2/+0
|\ \ \ | | | | | | | | tests: index: do not re-allocate index
| * | | tests: index: do not re-allocate indexPatrick Steinhardt2016-08-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Plug a memory leak caused by re-allocating a `git_index` structure which has already been allocated by the test suite's initializer.
* | | | git_checkout_tree options fixStefan Huber2016-08-301-0/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | 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.
* | | Teach `git_patch_from_diff` about parsed diffsethomson/patch_from_diffEdward Thomson2016-08-241-0/+45
| | | | | | | | | | | | | | | Ensure that `git_patch_from_diff` can return the patch for parsed diffs, not just generate a patch for a generated diff.
* | | Merge pull request #3837 from novalis/dturner/indexv4Edward Thomson2016-08-172-0/+80
|\ \ \ | | | | | | | | Support index v4
| * | | index: support index v4David Turner2016-08-101-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | varint: Add varint encoding/decodingDavid Turner2016-08-101-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This code is ported from git.git Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: David Turner <dturner@twopensource.com>
* | | | Merge pull request #3895 from pks-t/pks/negate-basename-in-subdirsEdward Thomson2016-08-171-0/+38
|\ \ \ \ | |/ / / |/| | | ignore: allow unignoring basenames in subdirectories