tests/checkout/tree.c


Log

Author Commit Date CI Message
Dimitris Apostolou 90df4302 2022-01-05T12:18:05 Fix typos
Edward Thomson ca14942e 2021-11-11T13:28:08 tests: declare functions statically where appropriate
Edward Thomson 95117d47 2021-10-31T09:45:46 path: separate git-specific path functions from util Introduce `git_fs_path`, which operates on generic filesystem paths. `git_path` will be kept for only git-specific path functionality (for example, checking for `.git` in a path).
Edward Thomson f0e693b1 2021-09-07T17:53:49 str: introduce `git_str` for internal, `git_buf` is external libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
Jochen Hunz 958205a3 2021-04-14T22:05:47 implement GIT_CHECKOUT_DRY_RUN to allow notifications without touching the working directory
lhchavez 3a197ea7 2020-06-27T12:33:32 Make the tests pass cleanly with MemorySanitizer This change: * Initializes a few variables that were being read before being initialized. * Includes https://github.com/madler/zlib/pull/393. As such, it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
Patrick Steinhardt e54343a4 2019-06-29T09:17:32 fileops: rename to "futils.h" to match function signatures Our file utils functions all have a "futils" prefix, e.g. `git_futils_touch`. One would thus naturally guess that their definitions and implementation would live in files "futils.h" and "futils.c", respectively, but in fact they live in "fileops.h". Rename the files to match expectations.
Edward Thomson 168fe39b 2018-11-28T14:26:57 object_type: use new enumeration names Use the new object_type enumeration names within the codebase.
Edward Thomson 18e71e6d 2018-11-28T13:31:06 index: use new enum and structure names Use the new-style index names throughout our own codebase.
Patrick Steinhardt 0652abaa 2018-07-20T12:56:49 Merge pull request #4702 from tiennou/fix/coverity Assorted Coverity fixes
Patrick Steinhardt 9994cd3f 2018-06-25T11:56:52 treewide: remove use of C++ style comments C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
Etienne Samson 8455a270 2018-07-01T12:04:27 tests: add missing cl_git_pass to tests Reported by Coverity, CID 1393678-1393697.
Edward Thomson 5e26391a 2018-06-18T18:28:08 checkout: FORCE doesn't halt on dirty index If the index is dirty, allow `GIT_CHECKOUT_FORCE` to obliterate unsaved changes. This is in keeping with its name and description.
Edward Thomson b242cdbf 2017-11-17T00:19:07 index: commit the changes to the index properly Now that the index has a "dirty" state, where it has changes that have not yet been committed or rolled back, our tests need to be adapted to actually commit or rollback the changes instead of assuming that the index can be operated on in its indeterminate state.
Edward Thomson 55a96606 2018-06-18T16:14:26 checkout tests: validate GIT_CHECKOUT_NO_REFRESH Add tests that ensure that we re-read the on-disk image by default during checkout, but when the `GIT_CHECKOUT_NO_REFRESH` option is specified, we do _not_ re-read the index.
Patrick Steinhardt ecf4f33a 2018-02-08T11:14:48 Convert usage of `git_buf_free` to new `git_buf_dispose`
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.
Patrick Steinhardt 09c15a7f 2017-10-09T09:08:19 tests: checkout::tree: check that the status list catches mode changes While we verify that we have no mode changes after calling `git_checkout_tree`, we do not verify that the `p_chmod` calls actually resulted in a changed entry. While we should assume that this works due to separate tests for the status list, we should test for the change being listed to avoid programming errors in the test.
Patrick Steinhardt 880dfc50 2017-10-09T09:06:24 tests: checkout::tree: extract check for status entrycount There are multiple locations where we have the same code to check whether the count of status list entries of a repository matches an expected number. Extract that into a common function.
Edward Thomson 19e8faba 2016-06-15T01:59:56 checkout: test force checkout when mode changes Test that we can successfully force checkout a target when the file contents are identical, but the mode has changed.
Edward Thomson 1f813cf2 2017-01-23T17:32:13 checkout::tree test: cleanup memory leak
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).
Stefan Huber 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.
Edward Thomson 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`.
Edward Thomson eea7c850 2015-09-16T05:44:27 checkout: overwrite files with differing modes When a file exists on disk and we're checking out a file that differs in executableness, remove the old file. This allows us to recreate the new file with p_open, which will take the new mode into account and handle setting the umask properly. Remove any notion of chmod'ing existing files, since it is now handled by the aforementioned removal and was incorrect, as it did not take umask into account.
Edward Thomson 6fe32284 2015-09-16T10:17:54 checkout::tree tests: don't use hardcoded mode
Edward Thomson b4d183a7 2015-09-16T04:12:47 checkout::tree tests: don't use static buffer
Matti Virolainen 33cad995 2015-06-01T14:31:49 Check that checkout preserves filemode in working directory.
Matti Virolainen 6124d983 2015-06-01T11:16:36 Check that an executable in index is not an executable after checkout.
Edward Thomson 885b94aa 2015-05-28T15:26:13 Rename GIT_EMERGECONFLICT to GIT_ECONFLICT We do not error on "merge conflicts"; on the contrary, merge conflicts are a normal part of merging. We only error on "checkout conflicts", where a change exists in the index or the working directory that would otherwise be overwritten by performing the checkout. This *may* happen during merge (after the production of the new index that we're going to checkout) but it could happen during any checkout.
Edward Thomson 2f1080ea 2015-05-19T11:17:07 conflict tests: use GIT_IDXENTRY_STAGE_SET
Edward Thomson 64842d87 2015-04-23T09:21:33 checkout test: only run icase on icase platform
Edward Thomson 3520c970 2015-03-27T15:39:28 Revert "Always checkout with case sensitive iterator" This reverts commit 40d791545abfb3cb71553a27dc64129e1a9bec28.
Edward Thomson 6dfd8506 2015-04-01T15:23:37 checkout test: ensure we write to casechanged dir Ensure that on a case insensitive filesystem that we can checkout into some folder 'FOLDER' that exists on disk, even if the target of the checkout is a different case (eg 'folder').
Edward Thomson 431f9807 2015-03-27T15:33:44 checkout test: ignore unstaged case-changing renames On Windows, you might sloppily rewrite a file (or have a sloppy text editor that does it for you) and accidentally change its case. (eg, "README" -> "readme"). Git ignores this accidental case changing rename during checkout and will happily write the new content to the file despite the name change. We should, too.
John Fultz 67db2bde 2015-03-10T12:02:45 Fix git_checkout_tree() to do index filemodes correctly on Windows. git_checkout_tree() has some fallback behaviors for file systems which don't have full support of filemodes. Generally works fine, but if a given file had a change of type from a 0644 to 0755 (i.e., you add executable permissions), the fallback behavior incorrectly triggers when writing hte updated index. This would cause a git_checkout_tree() command, even with the GIT_CHECKOUT_FORCE option set, to leave a dirty index on Windows. Also added checks to an existing test to catch this case.
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 6bfb990d 2015-01-07T14:47:02 branch: don't accept a reflog message override This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace.
Carlos Martín Nieto 23a17803 2015-01-07T14:16:50 reset: remove reflog message override This function is meant to simulate what git does in the reset command, so we should include the reflog message in that.
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 496b76d4 2015-02-27T11:02:37 checkout tests: just use SAFE where appropriate
Edward Thomson 96b82b11 2015-02-14T11:44:05 checkout: remove `GIT_CHECKOUT_SAFE_CREATE` as a strategy
Edward Thomson e6da3e44 2015-02-14T10:33:06 checkout: upgrade to `SAFE_CREATE` when no index file When the repository does not contain an index, emulate git's behavior and upgrade to `SAFE_CREATE`. This allows us to check out repositories created with `git clone --no-checkout`.
Edward Thomson 8639ea5f 2015-01-17T22:47:03 checkout: introduce GIT_CHECKOUT_DONT_WRITE_INDEX
Edward Thomson fa89ff20 2015-02-03T05:35:24 remove some unused warnings
Edward Thomson 2fbce0bf 2015-02-02T22:18:38 checkout test: ensure .gitattributes lifecycle The .gitattributes cache should not reload .gitattributes in the middle of checking out, only between checkout operations. Otherwise, we'll spend all our time stat'ing and read'ing the gitattributes.
Edward Thomson 1d50b364 2015-01-12T16:16:27 checkout: introduce git_checkout_perfdata Checkout can now provide performance data about the number of (some) syscalls performed using an optional callback.
Carlos Martín Nieto c4a2fd5c 2015-01-04T17:39:43 Plug a couple of leaks
Edward Thomson 40d79154 2014-05-09T19:32:52 Always checkout with case sensitive iterator On a case-insensitive filesystem, we need to deal with case-changing renames (eg, foo -> FOO) by removing the old and adding the new, exactly as if we were on a case-sensitive filesystem. Update the `checkout::tree::can_cancel_checkout_from_notify` test, now that notifications are always sent case sensitively.
Edward Thomson 61ee5b0e 2014-05-08T17:35:03 Introduce test for checkout case-changing rename
Carlos Martín Nieto f7fcb18f 2014-11-23T14:12:54 Plug leaks Valgrind is now clean except for libssl and libgcrypt.
Edward Thomson 9f664347 2014-11-06T14:40:21 checkout_index: remove conflicts when checking out new files
Sven Strickroth b8add6c4 2014-08-03T15:44:13 Allow to propagate checkout callbacks to git HARD reset Signed-off-by: Sven Strickroth <email@cs-ware.de>
Ben Straub 6affd71f 2014-01-03T17:38:34 git_checkout_opts -> git_checkout_options
Ben Straub 586be3b8 2014-02-03T15:05:55 Add reflog parameters to git_reset
Ben Straub b31ebfbc 2014-01-27T14:12:29 Add reflog params to git_branch_create
Ben Straub 94f263f5 2014-01-25T08:04:49 Add reflog params to set-head calls
Carlos Martín Nieto d541170c 2014-01-24T11:36:41 index: rename an entry's id to 'id' This was not converted when we converted the rest, so do it now.
Edward Thomson e8b81c69 2014-01-22T13:24:32 Preserve tree filemode in index during checkout Don't try to determine whether the system supports file modes when putting the tree data in the index during checkout. The tree's mode is canonical and did not come from stat(2) in the first place.
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.
Edward Thomson bf4a577c 2013-12-13T10:10:32 Overwrite ignored directories on checkout
Edward Thomson 81a2012d 2013-12-12T11:30:50 Overwrite ignored files on checkout
Russell Belfer 8046b26c 2013-12-10T16:16:36 Try a test that won't assert on Linux
Russell Belfer cbd04896 2013-12-10T14:38:35 Fix checkout notify callback docs and tests The checkout notify callback behavior on non-zero return values was not being tested. This adds tests, fixes a bug with positive values, and clarifies the documentation to make it clear that the checkout can be canceled via this mechanism.
Ben Straub 17820381 2013-11-14T14:05:52 Rename tests-clar to tests