tests


Log

Author Commit Date CI Message
Edward Thomson b13f0da1 2017-02-17T16:32:14 Merge pull request #4130 from libgit2/ethomson/clar_messages Improve clar messages
Edward Thomson c52480fd 2017-02-17T13:01:49 `cl_git_exec` -> `cl_git_expect`
Edward Thomson a1dcc830 2017-02-17T12:13:35 tests: provide better pass/failure error messages Provide more detailed messages when conditions pass or fail unexpectedly. In particular, this provides the error messages when a test fails with a different error code than was expected.
Patrick Steinhardt cb18386f 2017-01-25T14:26:58 khash: avoid using `kh_val`/`kh_value` directly
Patrick Steinhardt a853c527 2017-01-25T14:14:32 khash: avoid using `kh_get` directly
Patrick Steinhardt 64e46dc3 2017-01-25T14:14:12 khash: avoid using `kh_end` directly
Patrick Steinhardt 0d716905 2017-01-27T15:23:15 oidmap: remove GIT__USE_OIDMAP macro
Patrick Steinhardt 13c3bc9a 2017-01-27T14:32:23 strmap: remove GIT__USE_STRMAP macro
Patrick Steinhardt 73028af8 2017-01-27T14:20:24 khash: avoid using macro magic to get return address
Patrick Steinhardt 85d2748c 2017-01-27T14:05:10 khash: avoid using `kh_key`/`kh_val` as lvalue
Patrick Steinhardt f31cb45a 2017-01-25T15:31:12 khash: avoid using `kh_put` directly
Edward Thomson 4f9f8e0d 2017-02-13T11:10:49 Merge pull request #3436 from pks-t/libgit2-worktree Worktree implementation
Patrick Steinhardt 3f3a4ce7 2016-11-09T14:18:22 worktree: test opening worktree via gitlink, gitdir and worktree
Patrick Steinhardt 6f6dd17c 2016-11-08T12:13:59 worktree: test creating and opening submodule worktrees
Patrick Steinhardt 1fd6e035 2016-11-07T10:23:34 worktree: test opening discovered submodule worktrees
Patrick Steinhardt 39abd3ad 2016-11-04T13:39:54 worktree: compute workdir for worktrees opened via their gitdir When opening a worktree via the gitdir of its parent repository we fail to correctly set up the worktree's working directory. The problem here is two-fold: we first fail to see that the gitdir actually is a gitdir of a working tree and then subsequently fail to determine the working tree location from the gitdir. The first problem of not noticing a gitdir belongs to a worktree can be solved by checking for the existence of a `gitdir` file in the gitdir. This file points back to the gitlink file located in the working tree's working directory. As this file only exists for worktrees, it should be sufficient indication of the gitdir belonging to a worktree. The second problem, that is determining the location of the worktree's working directory, can then be solved by reading the `gitdir` file in the working directory's gitdir. When we now resolve relative paths and strip the final `.git` component, we have the actual worktree's working directory location.
Patrick Steinhardt 84f56cb0 2016-11-04T11:59:52 repository: rename `path_repository` and `path_gitlink` The `path_repository` variable is actually confusing to think about, as it is not always clear what the repository actually is. It may either be the path to the folder containing worktree and .git directory, the path to .git itself, a worktree or something entirely different. Actually, the intent of the variable is to hold the path to the gitdir, which is either the .git directory or the bare repository. Rename the variable to `gitdir` to avoid confusion. While at it, also rename `path_gitlink` to `gitlink` to improve consistency.
Patrick Steinhardt 384518d0 2015-10-27T14:17:52 repository: restrict checking out checked out branches If a branch is already checked out in a working tree we are not allowed to check out that branch in another repository. Introduce this restriction when setting a repository's HEAD.
Patrick Steinhardt 143e539f 2015-11-06T12:33:59 branch: restrict branch deletion for worktrees Restrict the ability to delete branches that are checked out in any linked repository.
Patrick Steinhardt 4321595d 2015-11-10T16:54:48 worktree: test basic merge functionality
Patrick Steinhardt 04fb12ab 2015-10-27T12:37:51 worktree: implement functions reading HEAD Implement `git_repository_head_for_worktree` and `git_repository_head_detached_for_worktree` for directly accessing a worktree's HEAD without opening it as a `git_repository` first.
Patrick Steinhardt f0cfc341 2015-10-21T13:53:18 worktree: implement `git_worktree_prune` Implement the `git_worktree_prune` function. This function can be used to delete working trees from a repository. According to the flags passed to it, it can either delete the working tree's gitdir only or both gitdir and the working directory.
Patrick Steinhardt 2a503485 2015-10-21T16:03:04 worktree: implement locking mechanisms Working trees support locking by creating a file `locked` inside the tree's gitdir with an optional reason inside. Support this feature by adding functions to get and set the locking status.
Patrick Steinhardt dea7488e 2015-10-23T14:11:44 worktree: implement `git_worktree_add` Implement the `git_worktree_add` function which can be used to create new working trees for a given repository.
Patrick Steinhardt 372dc9ff 2015-10-21T13:49:55 worktree: implement `git_worktree_validate` Add a new function that checks wether a given `struct git_worktree` is valid. The validation includes checking if the gitdir, parent directory and common directory are present.
Patrick Steinhardt 8c8d726e 2015-10-21T12:10:30 worktree: implement `git_repository_open_from_worktree` Add function `git_repository_open_from_worktree`, which allows to open a `git_worktree` as repository.
Patrick Steinhardt a6bddf60 2017-02-13T10:34:08 tests: fix permissions on testrepo.git index file
Patrick Steinhardt d3bc09e8 2015-10-21T12:02:31 worktree: introduce `struct git_worktree` Introduce a new `struct git_worktree`, which holds information about a possible working tree connected to a repository. Introduce functions to allow opening working trees for a repository.
Patrick Steinhardt 45f2b7a4 2015-10-21T11:48:02 worktree: implement `git_worktree_list` Add new module for working trees with the `git_worktree_list` function. The function lists names for all working trees of a certain repository.
Patrick Steinhardt 4292837d 2015-09-24T14:37:10 config: open configuration in commondir A repository's configuartion file can always be found in the GIT_COMMON_DIR, which has been newly introduced. For normal repositories this does change nothing, but for working trees this change allows to access the shared configuration file.
Patrick Steinhardt e9403024 2015-09-24T15:32:26 refdb: look for reflog in commondir
Patrick Steinhardt e0a6c28e 2015-09-16T16:09:24 refdb: introduce commondir awareness The refdb_fs_backend is not aware of the git commondir, which stores common objects like the o bject database and packed/loose refereensces when worktrees are used. Make refdb_fs_backend aware of the common directory by introducing a new commonpath variable that points to the actual common path of the database and using it instead of the gitdir for the mentioned objects.
Patrick Steinhardt 79ab3ef6 2015-10-15T15:58:05 repository: introduce is_worktree variable
Patrick Steinhardt c09fd54e 2015-09-16T12:10:11 repository: introduce commondir variable The commondir variable stores the path to the common directory. The common directory is used to store objects and references shared across multiple repositories. A current use case is the newly introduced `git worktree` feature, which sets up a separate working copy, where the backing git object store and references are pointed to by the common directory.
Patrick Steinhardt 807d57e7 2015-11-11T10:54:41 tests: implement worktree helpers
Patrick Steinhardt 8acc3b16 2015-11-10T15:53:09 tests: add merge-conflict branch for testrepo Add a new branch that causes a merge conflict to `testrepo` so that we are able to test merging in worktrees.
Patrick Steinhardt e5a620de 2015-11-09T17:00:41 tests: add submodule worktree test data Create worktrees for submodule repositories. The worktrees are created for the parent repository (e.g. the one containing submodules) and for the contained child repository.
Patrick Steinhardt bd9f4fd2 2015-11-11T10:54:08 tests: add worktree test data
Edward Thomson 683ff4f3 2017-02-10T11:01:23 Merge pull request #4111 from pks-t/pks/dos-prefix dirname with DOS prefixes
Edward Thomson 49806e9b 2017-02-09T16:52:03 merge_trees: introduce test for submodule renames Test that shows that submodules are incorrectly considered in renames, and `git_merge_trees` will fail to lookup the submodule as a blob.
Patrick Steinhardt 3428a523 2017-02-08T12:02:32 tests: repo: assert discovery starting at Win32 roots finishes As of recently, we failed to correctly discover repositories at a Win32 system root. Instead of aborting the upwards-traversal of the file system, we were looping infinitely when traversal started at either a Win32 drive prefix ("C:/") or a network path ("//somehost"). The issue has been fixed, so add a test to catch regressions.
Patrick Steinhardt 9e8d75c7 2017-02-08T11:41:10 path: ensure dirname on Win32 prefix always has a trailing '/' When calling `git_path_dirname_r` on a Win32 prefix, e.g. a drive or network share prefix, we always want to return the trailing '/'. This does not work currently when passing in a path like 'C:', where the '/' would not be appended correctly. Fix this by appending a '/' if we try to normalize a Win32 prefix and there is no trailing '/'.
Patrick Steinhardt 5d59520c 2017-02-07T20:30:11 path: get correct dirname for Windows root Getting the dirname of a filesystem root should return the filesystem root itself. E.g. the dirname of "/" is always "/". On Windows, we emulate this behavior and as such, we should return e.g. "C:/" if calling dirname on "C:/". But we currently fail to do so and instead return ".", as we do not check if we actually have a Windows prefix before stripping off the last directory component. Fix this by calling out to `win32_prefix_length` immediately after stripping trailing slashes, returning early if we have a prefix.
Adam Niedzielski 390431c3 2017-02-01T17:31:31 revwal: add failing test for walking with topo-sort
Edward Thomson 1f813cf2 2017-01-23T17:32:13 checkout::tree test: cleanup memory leak
Edward Thomson 98f53872 2017-01-21T18:57:28 Merge pull request #4016 from novalis/submodule-optimization Submodule optimization
Edward Thomson 52949c80 2017-01-21T18:30:12 Merge branch 'pr/4060'
Brock Peabody 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>
Edward Thomson 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.
Carlos Martín Nieto 2854e619 2017-01-14T17:12:23 Merge pull request #4061 from libgit2/ethomson/merge_opts merge: set default rename threshold
lhchavez f5586f5c 2017-01-14T16:37:00 Addressed review feedback
Carlos Martín Nieto a6d833a2 2017-01-13T17:05:58 Merge pull request #4049 from libgit2/ethomson/error_msgs giterr_set: consistent error messages
Carlos Martín Nieto 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.
Carlos Martín Nieto 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.
Carlos Martín Nieto 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.
lhchavez a7ff6e5e 2017-01-03T18:24:51 Fix the memory leak
lhchavez def644e4 2017-01-01T17:35:29 Add a test
Edward Thomson 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.
John Fultz 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).
Edward Thomson 8f0d5cde 2016-12-29T12:55:49 tests: update error message checking
Edward Thomson 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
Carlos Martín Nieto 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.
Carlos Martín Nieto f7dcd58c 2016-12-17T00:55:06 rebase: plug a leak in the tests
Edward Thomson 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
Carlos Martín Nieto 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.
Patrick Steinhardt 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.
David Turner 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.
Edward Thomson 6367c58c 2016-11-18T18:30:20 tests: handle life without threads
Edward Thomson 6a05c7a0 2016-11-18T07:37:47 threads::refdb tests: use new threaded clar assert
Edward Thomson 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.
Edward Thomson 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.
Edward Thomson 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 *`.
Carlos Martín Nieto a39f18ac 2016-11-14T17:10:43 Merge pull request #3998 from pks-t/pks/repo-discovery Repository discovery starting from files
Edward Thomson df045cef 2016-11-14T12:12:38 Merge pull request #4003 from libgit2/cmn/tree-updater-ordering Use the sorted input in the tree updater
Carlos Martín Nieto 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.
Carlos Martín Nieto aef54a46 2016-11-14T11:29:40 refdb: use a constant for the number of per-thread creations/deletes
Carlos Martín Nieto 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.
Carlos Martín Nieto 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.
Carlos Martín Nieto 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.
Carlos Martín Nieto 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.
Patrick Steinhardt 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.
Patrick Steinhardt 4dbaf3cd 2016-11-14T10:52:37 test: discover: fix indentation
Patrick Steinhardt 5242c424 2016-11-11T16:43:37 test: discover: split up monolithic test into smaller ones
Patrick Steinhardt 07afeb23 2016-11-11T16:16:34 test: discover: pass constants to ensure_repository_discover
Patrick Steinhardt 2382b0f8 2016-11-11T15:50:14 test: discover: move layout creation into test initializer
Patrick Steinhardt 5fe5557e 2016-11-04T18:18:46 Merge pull request #3974 from libgit2/pks/synchronize-shutdown global: synchronize initialization and shutdown with pthreads
Patrick Steinhardt 6e2fab9e 2016-11-04T18:14:00 Merge pull request #3977 from jfultz/fix-forced-branch-creation-on-bare-repo
John Fultz 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.
Patrick Steinhardt 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`.
Patrick Steinhardt 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.
Patrick Steinhardt 30a876cd 2016-10-27T11:29:15 tests: fetchhead: fix memory leak
Patrick Steinhardt 61ad9bcd 2016-10-27T11:26:52 tests: vector: fix memory leak
Edward Thomson 610cff13 2016-10-09T16:05:48 Merge branch 'pr/3809'
Sim Domingo dc5cfdba 2016-06-02T23:18:31 make git_diff_stats_to_buf not show 0 insertions or 0 deletions
Arthur Schreiber 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.
Edward Thomson 45dc219f 2016-10-07T16:01:28 Merge pull request #3921 from libgit2/cmn/walk-limit-enough Improve revision walk preparation logic
Arthur Schreiber ab96ca55 2016-10-06T13:15:31 Make sure we use the `C` locale for `regcomp` on macOS.
Carlos Martín Nieto 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`.
Carlos Martín Nieto 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.
Carlos Martín Nieto 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.