tests/repo


Log

Author Commit Date CI Message
Edward Thomson eebc5e0d 2018-01-03T15:15:16 Merge pull request #4257 from pks-t/pks/stale-test Execute stale tests
Patrick Steinhardt 72c28ab0 2017-06-07T10:59:03 tests: status::worktree: indicate skipped tests on Win32 Some function bodies of tests which are not applicable to the Win32 platform are completely #ifdef'd out instead of calling `cl_skip()`. This leaves us with no indication that these tests are not being executed at all and may thus cause decreased scrutiny when investigating skipped tests. Improve the situation by calling `cl_skip()` instead of just doing nothing.
Etienne Samson 53672128 2017-07-21T17:35:30 tests: gather the reflog entry content tests
Christine Poerschke 732c0b6d 2017-11-12T15:17:31 s/Init/Index comment tweak for test_repo_init__init_with_initial_commit
Ariel Davis 8e912e79 2017-06-16T21:05:58 tests: try to init with empty template path
Carlos Martín Nieto e694e4e9 2017-05-20T14:17:36 Merge pull request #4174 from libgit2/ethomson/set_head_to_tag git_repository_set_head: use tag name in reflog
Patrick Steinhardt ffd264d9 2017-05-03T14:51:23 tests: repo: fix repo discovery tests on overlayfs Debian and Ubuntu often use schroot to build their DEB packages in a controlled environment. Depending on how schroot is configured, our tests regarding repository discovery break due to not being able to find the repositories anymore. It turns out that these errors occur when the schroot is configured to use an overlayfs on the directory structures. The reason for this failure is that we usually refrain from discovering repositories across devices. But unfortunately, overlayfs does not have consistent device identifiers for all its files but will instead use the device number of the filesystem the file stems from. So whenever we cross boundaries between the upper and lower layer of the overlay, we will fail to properly detect the repository and bail out. This commit fixes the issue by enabling cross-device discovery in our tests. While it would be preferable to have this turned off, it probably won't do much harm anyway as we set up our tests in a temporary location outside of the parent repository.
Edward Thomson e86d02f9 2017-04-03T00:10:47 git_repository_set_head: use remote name in reflog When `git_repository_set_head` is provided a remote reference, update the reflog with the tag name, like we do with a branch. This helps consumers match the semantics of `git checkout remote`.
Edward Thomson ea3bb5c0 2017-03-21T18:12:02 git_repository_set_head: use tag name in reflog When `git_repository_set_head` is provided a tag reference, update the reflog with the tag name, like we do with a branch. This helps consumers match the semantics of `git checkout tag`.
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 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 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
Edward Thomson e02f5676 2016-07-15T12:43:57 repo::open: remove dead code, free buffers
Josh Triplett 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.
Josh Triplett 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.
Josh Triplett 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.
Edward Thomson de034cd2 2016-03-18T10:59:38 iterator: give the tests a proper hierarchy Iterator tests were split over repo::iterator and diff::iterator, with duplication between the two. Move them to iterator::index, iterator::tree, and iterator::workdir.
Edward Thomson 6cd9573f 2016-03-17T15:09:38 iterator: test that we can `advance_into` empty dirs Prior iterator implementations returned `GIT_ENOTFOUND` when trying to advance into empty directories. Ensure that we no longer do that and simply handle them gracefully.
Marc Strapetz ae86aa5a 2016-03-16T11:38:02 iterator: test pathlist handling for directories tree_iterator was only working properly for a pathlist containing file paths. In case of directory paths, it didn't match children which contradicts GIT_DIFF_DISABLE_PATHSPEC_MATCH and is different from index_iterator and fs_iterator. As a consequence head-to-index status reporting for a specific directory did not work properly -- all files have been reported as added. Include additional tests.
Edward Thomson 6bcddf88 2016-03-16T17:14:36 iterator: test `advance_over` with a pathlist
Edward Thomson 9fb2527f 2016-03-16T16:29:38 iterator: add tests for advance_over `git_iterator_advance_over` is a gnarly bit of code with no actual tests.
Edward Thomson 85541f43 2016-03-16T13:31:35 iterator: test workdir pathlist with deep paths In the workdir iterator we do some tricky things to step down into directories to look for things that are in our pathlist. Make sure that we don't confuse between folders that we're definitely going to return everything in and folders that we're only stepping down into to keep looking for matches.
Edward Thomson 908d8de8 2016-03-16T12:15:55 iterator: workdir tests with submodules Ensure that when specifying start/end paths, or pathlists, that we deal correctly with submodules.
Edward Thomson c3d195f1 2016-03-16T11:45:44 iterator: expand workdir tests with pathlist Expand the workdir tests to validate the paths in case sensitive and insensitive tests.
Edward Thomson 4c88198a 2016-03-16T10:17:20 iterator: test that we're at the end of iteration Ensure that we have hit the end of iteration; previously we tested that we saw all the values that we expected to see. We did not then ensure that we were at the end of the iteration (and that there were subsequently values in the iteration that we did *not* expect.)
Edward Thomson d051de24 2016-03-10T12:54:33 iterator: test fs iterator w/ many nested empty dirs
Edward Thomson a4f520a6 2016-03-10T11:07:13 iterator: skip unreadable directories in fs iterator Do not abort iteration in the middle when encountering an unreadable directory. Instead, skip it, as if it didn't exist.
Edward Thomson be30387e 2016-02-25T16:05:18 iterators: refactored tree iterator Refactored the tree iterator to never recurse; simply process the next entry in order in `advance`. Additionally, reduce the number of allocations and sorting as much as possible to provide a ~30% speedup on case-sensitive iteration. (The gains for case-insensitive iteration are less majestic.)
Edward Thomson 277c85eb 2016-03-02T15:38:13 repo::iterator: don't go out of bounds
Edward Thomson 684b35c4 2016-02-25T15:11:14 iterator: disambiguate reset and reset_range Disambiguate the reset and reset_range functions. Now reset_range with a NULL path will clear the start or end; reset will leave the existing start and end unchanged.
Arthur Schreiber 3679ebae 2016-02-11T23:37:52 Horrible fix for #3173.
Edward Thomson 62602547 2015-12-26T22:39:22 git_repository_init: include dotfiles when copying templates Include dotfiles when copying template directory, which will handle both a template directory itself that begins with a dotfile, and any dotfiles inside the directory.
Edward Thomson 00282183 2015-12-26T22:32:17 repo::init tests: test a template dir with leading dot Ensure that we can handle template directories that begin with a leading dot.
Edward Thomson 5c042c5b 2015-12-26T22:06:45 repo::init tests: test init.templatedir setting Ensure that `git_repository_init` honors the `init.templatedir` configuration setting.
Carlos Martín Nieto 2ea40fda 2015-11-20T13:19:23 repository: distinguish sequencer cherry-pick and revert These are not quite like their plain counterparts and require special handling.
Carlos Martín Nieto aebddbe7 2015-09-21T06:01:03 Merge pull request #3434 from ethomson/reservednames Win32 Reserved names: don't reserve names outside the working directory
Edward Thomson e8ddd8d7 2015-09-17T17:49:32 repo::reservedname: test a submodule update Test an initial submodule update, where we are trying to checkout the submodule for the first time, and placing a file within the submodule working directory with the same name as the submodule (and consequently, the same name as the repository itself).
Edward Thomson ac2fba0e 2015-09-16T15:07:27 git_futils_mkdir_*: make a relative-to-base mkdir Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter assumes that we own everything beneath the base, as if it were being called with a base of the repository or working directory, and is tailored towards checkout and ensuring that there is no bogosity beneath the base that must be cleaned up. This is (at best) slow and (at worst) unsafe in the larger context of a filesystem where we do not own things and cannot do things like unlink symlinks that are in our way.
Edward Thomson 03210cfa 2015-08-31T12:12:21 iterator test: handle case (in)sensitivity
Edward Thomson 4d19bced 2015-08-30T19:33:18 iterator test: use new iter opts in fifo test
Edward Thomson d53c8880 2015-08-30T19:25:47 iterator: saner pathlist matching for idx iterator Some nicer refactoring for index iteration walks. The index iterator doesn't binary search through the pathlist space, since it lacks directory entries, and would have to binary search each index entry and all its parents (eg, when presented with an index entry of `foo/bar/file.c`, you would have to look in the pathlist for `foo/bar/file.c`, `foo/bar` and `foo`). Since the index entries and the pathlist are both nicely sorted, we walk the index entries in lockstep with the pathlist like we do for other iteration/diff/merge walks.
Edward Thomson 1af84271 2015-08-30T18:35:57 tree_iterator: use a pathlist
Edward Thomson 4a0dbeb0 2015-08-30T17:06:26 diff: use new iterator pathlist handling When using literal pathspecs in diff with `GIT_DIFF_DISABLE_PATHSPEC_MATCH` turn on the faster iterator pathlist handling. Updates iterator pathspecs to include directory prefixes (eg, `foo/`) for compatibility with `GIT_DIFF_DISABLE_PATHSPEC_MATCH`.
Edward Thomson 6c9352bf 2015-08-28T18:30:39 iterator: sort subdirs properly with pathlist When given a pathlist, don't assume that directories sort before files. Walk through any list of entries sorting before us to make sure that we've exhausted all entries that *aren't* directories. Eg, if we're searching for 'foo/bar', and we have a 'foo.c', keep advancing the pathlist to keep looking for an entry prefixed with 'foo/'.
Edward Thomson ef206124 2015-07-28T19:55:37 Move filelist into the iterator handling itself.
Edward Thomson ed1c6446 2015-07-28T11:41:27 iterator: use an options struct instead of args
Carlos Martín Nieto 0e391d85 2015-07-27T13:31:06 iterator: adjust unreadable-dir test to new behaviour We don't want the iterator to make us stop whenever we hit an unreadable dir. We should instead move over to the next item.
Edward Thomson e069c621 2015-07-02T09:25:48 git__getenv: utf-8 aware env reader Introduce `git__getenv` which is a UTF-8 aware `getenv` everywhere. Make `cl_getenv` use this to keep consistent memory handling around return values (free everywhere, as opposed to only some platforms).
Pierre-Olivier Latour 8113056c 2015-06-23T20:57:09 Fixed Xcode 6.1 build warnings
Carlos Martín Nieto 16c73d38 2015-06-23T20:44:27 repository: check the format version This is something we do on re-init but not when opening a repository. This hasn't particularly mattered up to now as the version has been 0 ever since the first release of git, but the times, they're a-changing and we will soon see version 1 in the wild. We need to make sure we don't open those.
Carlos Martín Nieto 83ad46f7 2015-03-18T04:59:16 Merge remote-tracking branch 'ethomson/submodule_8dot3'
Carlos Martín Nieto a5815a2a 2015-03-07T00:30:40 Add tests for the annotated versions of ref-modifying functions This also brings the soft-reset tests back to life. The function name was missing an underscore, meaning they had not been running.
Edward Thomson 70c735e1 2015-03-10T16:49:24 repository_new: test its bareness
Carlos Martín Nieto 9a97f49e 2014-12-21T15:31:03 config: borrow refcounted references This changes the get_entry() method to return a refcounted version of the config entry, which you have to free when you're done. This allows us to avoid freeing the memory in which the entry is stored on a refresh, which may happen at any time for a live config. For this reason, get_string() has been forbidden on live configs and a new function get_string_buf() has been added, which stores the string in a git_buf which the user then owns. The functions which parse the string value takea advantage of the borrowing to parse safely and then release the entry.
Carlos Martín Nieto 4e498646 2015-01-15T16:50:31 repository: remove log message override for switching the active branch We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
Carlos Martín Nieto 659cf202 2015-01-07T12:23:05 Remove the signature from ref-modifying functions The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
Edward Thomson 4196dd8e 2015-02-26T15:33:58 repository: Introduce "reserved names" A repository can have multiple "reserved names" now, not just a single "short name" for the repository folder itself. Refactor to include a git_repository__reserved_names that returns all the reserved names for a repository.
Edward Thomson feb0e022 2015-02-19T12:14:06 tests: separate INVASIVE filesystem tests Introduce GITTEST_INVASIVE_FS_STRUCTURE for things that are invasive to your filesystem structure (like creating folders at your filesystem root) and GITTEST_INVASIVE_FS_SIZE for things that write lots of data.
Carlos Martín Nieto d24a5312 2015-02-12T02:34:58 Merge pull request #2866 from ethomson/checkout_perf2 Checkout performance
Edward Thomson 865baaf9 2015-02-05T11:06:01 repo: ensure we can create repo at filesystem root Test to ensure that we can create a repository at the filesystem root. Introduces a new test environment variable, `GITTEST_INVASIVE_FILESYSTEM` for tests that do terrible things like escaping the clar sandbox and writing to the root directory. It is expected that the CI builds will enable this but that normal people would not want this.
Edward Thomson 60561d54 2015-02-03T03:36:07 tests: update for new test data
Edward Thomson 3b40ed89 2015-01-08T19:23:37 repo::init test: create hook symlink Remove the hook symlink from the test resources, so that we can have a source tree that is easy to zip up and copy around on systems that don't support symlinks. Create it dynamically at test execution instead.
Carlos Martín Nieto 208a2c8a 2014-12-27T12:09:11 treebuilder: rename _create() to _new() This function is a constructor, so let's name it like one and leave _create() for the reference functions, which do create/write the reference.
Edward Thomson dce7b1a4 2014-12-16T19:24:04 treebuilder: take a repository for path validation Path validation may be influenced by `core.protectHFS` and `core.protectNTFS` configuration settings, thus treebuilders can take a repository to influence their configuration.
Carlos Martín Nieto 209425ce 2014-11-08T13:25:51 remote: rename _load() to _lookup() This brings it in line with the rest of the lookup functions.
Carlos Martín Nieto 62a617dc 2014-11-06T16:16:46 iterator: submodules are determined by an index or tree We cannot know from looking at .gitmodules whether a directory is a submodule or not. We need the index or tree we are comparing against to tell us. Otherwise we have to assume the entry in .gitmodules is stale or otherwise invalid. Thus we pass the index of the repository into the workdir iterator, even if we do not want to compare against it. This follows what git does, which even for `git diff <tree>`, it will consider staged submodules as such.
Carlos Martín Nieto 25abbc27 2014-09-17T03:19:40 Clean up some leaks in the test suite
Jameson Miller bc737620 2014-08-20T10:24:41 Introduce option to use relative paths for repository work directory Teach git_repository_init_ext to use relative paths for the gitlink to the work directory. This is used when creating a sub repository where the sub repository resides in the parent repository's .git directory.
Russell Belfer f18234fa 2014-08-08T13:17:50 Don't report status on named pipes Git skips entries in directories that are not S_ISDIR, S_ISREG, or S_ISLNK, so let's make libgit2 do the same thing.
Edward Thomson 0ba4dca5 2014-07-22T10:40:23 git_cherry_pick -> git_cherrypick
Edward Thomson 0cee70eb 2014-07-01T14:09:01 Introduce cl_assert_equal_oid
Cha, Hojeong 3ac1ff42 2014-05-27T23:32:38 Fix compile error on Visual Studio
Russell Belfer 8487e237 2014-05-15T10:56:28 Better search path sandboxing There are a number of tests that modify the global or system search paths during the tests. This adds a helper function to make it easier to restore those paths and makes sure that they are getting restored in a manner that preserves test isolation.
Jacques Germishuys efaa342c 2014-04-11T22:07:49 Correct C90 warnings
Jacques Germishuys c0311295 2014-04-07T17:32:23 git_repository_state_cleanup() should remove rebase-merge/, rebase-apply/ and BISECT_LOG
Carlos Martín Nieto 99797c96 2014-03-19T18:14:35 reflog: handle symref chains Given HEAD -> master -> foo, when updating foo's reflog we should also update HEAD's, as it's considered the current branch.
Carlos Martín Nieto 6aaae94a 2014-03-19T16:30:37 reflog: handle the birth of a branch The reflog append function was overzealous in its checking. When passed an old and new ids, it should not do any checking, but just serialize the data to a reflog entry.
Carlos Martín Nieto 1afe1400 2014-03-18T22:16:58 refdb: don't update when there's no need If the caller wants to update a ref to point to the same target as it currently has, we should return early and avoid writing to the reflog.
Carlos Martín Nieto bac95e6e 2014-03-18T19:41:03 reflog: more comprehensive HEAD tests The existing ones lack checking zeroed ids when switching back from an unborn branch as well as what happens when detaching. The reflog appending function mistakenly wrote zeros when dealing with a detached HEAD. This explicitly checks for those situations and fixes them.
Carlos Martín Nieto 4b7e1b9e 2014-01-15T13:19:48 refs: append to the HEAD reflog when updating the current branch When we update the current branch, we must also append to HEAD's reflog to keep them in sync. This is a bit of a hack, but as git.git says, it covers 100% of default cases.
Carlos Martín Nieto cb562c3f 2014-03-17T17:36:51 repo: remove test which deletes HEAD This is not something anybody would ever do; removing HEAD makes the .git/ directory no longer be a repository, so we wouldn't be expected to handle such a situation.
Edward Thomson 83634d38 2014-02-24T17:43:10 Move system directory cache out of utils
Russell Belfer 72556cc6 2014-02-20T14:27:10 Address PR comments * Make GIT_INLINE an internal definition so it cannot be used in public headers * Fix language in CONTRIBUTING * Make index caps API use signed instead of unsigned values
Ben Straub 9bda5fb8 2014-02-18T14:05:30 Improve error propagation in shallow call
Russell Belfer 2d929194 2014-02-07T16:14:17 Merge pull request #2099 from libgit2/bs/more-reflog-stuff More reflogness
Russell Belfer 3158e2fe 2014-02-07T15:24:39 Fix some Windows warnings This fixes a number of warnings with the Windows 64-bit build including a test failure in test_repo_message__message where an invalid pointer to a git_buf was being used.
Ben Straub 010cec3a 2014-02-04T20:50:40 Add reflog params to git_repository_detach_head
Ben Straub eec2761f 2014-02-03T15:06:32 Fix warning
Ben Straub 7ac1b899 2014-02-01T11:46:15 Add failing test case
Ben Straub a1710a28 2014-01-29T10:35:46 Enhance testing of signature parameters
Ben Straub 2952a9d0 2014-01-27T13:39:48 Ensure creating HEAD creates its reflog
Ben Straub a2311f92 2014-01-27T13:12:31 Ensure updating HEAD updates reflog
Ben Straub 94f263f5 2014-01-25T08:04:49 Add reflog params to set-head calls
Carlos Martín Nieto 7a3bd1e7 2014-01-26T15:35:17 repository: move to use a git_buf for outputting strings Since we now export that type, we can avoid making the user guess a size.
Carlos Martín Nieto 0b28217b 2014-01-15T12:51:31 refs: remove the _with_log differentiation Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.