tests


Log

Author Commit Date CI Message
Patrick Steinhardt ad5a909c 2017-03-14T09:39:37 patch_parse: fix parsing minimal trailing diff line In a diff, the shortest possible hunk with a modification (that is, no deletion) results from a file with only one line with a single character which is removed. Thus the following hunk @@ -1 +1 @@ -a + is the shortest valid hunk modifying a line. The function parsing the hunk body though assumes that there must always be at least 4 bytes present to make up a valid hunk, which is obviously wrong in this case. The absolute minimum number of bytes required for a modification is actually 2 bytes, that is the "+" and the following newline. Note: if there is no trailing newline, the assumption will not be offended as the diff will have a line "\ No trailing newline" at its end. This patch fixes the issue by lowering the amount of bytes required.
Patrick Steinhardt ace3508f 2017-03-14T10:37:47 patch_generate: fix `git_diff_foreach` only working with generated diffs The current logic of `git_diff_foreach` makes the assumption that all diffs passed in are actually derived from generated diffs. With these assumptions we try to derive the actual diff by inspecting either the working directory files or blobs of a repository. This obviously cannot work for diffs parsed from a file, where we do not necessarily have a repository at hand. Since the introduced split of parsed and generated patches, there are multiple functions which help us to handle patches generically, being indifferent from where they stem from. Use these functions and remove the old logic specific to generated patches. This allows re-using the same code for invoking the callbacks on the deltas.
Carlos Martín Nieto 53454be8 2017-03-11T19:52:05 Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting Skip uninteresting commits in revwalk timesort iterator
Edward Thomson ffd4df6b 2017-03-09T16:32:38 Merge pull request #4151 from novalis/dturner/rebase-submodule-untracked rebase: ignore untracked files in submodules
Adam Niedzielski c11c08a5 2017-03-09T14:01:10 Skip uninteresting commits in revwalk timesort iterator Fixes #4099
Edward Thomson d24ae06d 2017-03-06T13:13:47 refs::namespace: add namespace tests These simple tests only ensure that we enforce the existence of a namespace; these mirror the rugged tests, they are not exhaustive.
David Turner 2270ca9f 2017-03-03T13:27:47 rebase: ignore untracked files in submodules An untracked file in a submodule should not prevent a rebase from starting. Even if the submodule's SHA is changed, and that file would conflict with a new tracked file, it's still OK to start the rebase and discover the conflict later. Signed-off-by: David Turner <dturner@twosigma.com>
Edward Thomson 52d03f37 2017-03-03T13:26:29 git_commit_create: freshen tree objects in commit Freshen the tree object that a commit points to during commit time.
Edward Thomson d087c8f8 2017-02-24T14:14:56 hash: test for sha1 collision attack detection
Patrick Steinhardt 5aa1f12a 2017-03-01T07:45:14 tests: refs::create: fix memory leak
Patrick Steinhardt cf8e9a3a 2017-03-01T07:35:44 Merge pull request #4143 from richardipsum/issue-4094 Fix: make reflog include "(merge)" for merge commits
Richard Ipsum 397cf1a1 2017-02-28T22:22:02 Add test for inclusion of (merge) in reflog This test ensures that the string '(merge)' is included in the reflog when a merge commit is made.
Edward Thomson a4b5ac64 2017-02-26T16:12:30 Merge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test tests: Add create__symbolic_with_arbitrary_content
Kevin Wojniak 40170177 2017-02-25T10:21:59 Fix inet_pton tests triggering an assert in Haiku Haiku will assert in a nightly build if the "dst" input to inet_pton() is NULL.
Richard Ipsum b84e58f4 2017-02-25T14:17:10 Whitespace and style fixes Use C style comments as per style guide, and fix mismatching indentation.
Richard Ipsum d2b3a21f 2017-01-22T00:21:30 tests: Add create__symbolic_with_arbitrary_content This test ensures that it's possible to create a symbolic ref that has arbitrary data as its target. It also ensures it's possible to obtain the target of that symbolic reference from the git_reference object.
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