tests/checkout


Log

Author Commit Date CI Message
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.
Patrick Steinhardt 0ef405b3 2017-02-15T14:05:10 checkout: do not delete directories with untracked entries If the `GIT_CHECKOUT_FORCE` flag is given to any of the `git_checkout` invocations, we remove files which were previously staged. But while doing so, we unfortunately also remove unstaged files in a directory which contains at least one staged file, resulting in potential data loss. This commit adds two tests to verify behavior.
Patrick Steinhardt 78b8f039 2017-02-15T14:00:38 tests: fix indentation in checkout::head::with_index_only_tree
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`.
Patrick Steinhardt 292c6027 2016-06-07T12:29:16 tests: fix memory leaks in checkout::typechange
Edward Thomson c2f18b9b 2016-05-26T10:51:16 cleanup: unused warning
Edward Thomson e102daa4 2016-05-26T10:25:40 Merge pull request #3798 from mmuman/stat-test-fix test: Fix stat() test to mask out unwanted bits
Jason Haslam afab1fff 2016-02-16T21:02:41 checkout: handle dirty submodules correctly Don't generate conflicts when checking out a modified submodule and the submodule is dirty or modified in the workdir.
François Revol 407f2e9f 2016-05-24T19:07:09 test: Fix stat() test to mask out unwanted bits Haiku and Hurd both pass extra bits in struct stat::st_mode.
Edward Thomson 35439f59 2016-02-11T12:24:21 win32: introduce p_timeval that isn't stupid Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
Michał Górny 326c9fc2 2015-12-01T20:41:23 checkout test: Apply umask to file-mode test as well Fix the file-mode test to expect system umask being applied to the created file as well (it is currently applied to the directory only). This fixes the test on systems where umask != 022. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Jacques Germishuys 87428c55 2015-11-20T20:48:51 Fix some warnings
Edward Thomson de999f26 2015-11-13T15:36:45 checkout::crlf test: don't crash when no idx entry When there's no matching index entry (for whatever reason), don't try to dereference the null return value to get at the id. Otherwise when we break something in the index API, the checkout test crashes for confusing reasons and causes us to step through it in a debugger thinking that we had broken much more than we actually did.
Axel Rasmussen 0226f7dd 2015-08-29T13:59:20 diff/index: respect USE_NSEC for racily clean file detection
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 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 504b0697 2015-06-30T14:25:00 checkout test: mark unused vars
Edward Thomson 64c415c2 2015-06-29T22:12:20 checkout test: check getcwd return value
Carlos Martín Nieto afd8a94e 2015-06-26T18:49:39 checkout: plug a few leaks
Edward Thomson 1e46d545 2015-06-09T03:50:00 crlf tests: ensure that Unix obeys autocrlf=true All platforms do terrible, horrible, no good, very bad translation when core.autocrlf=true. It's not just Windows!
Edward Thomson 3d92b9ab 2015-06-08T09:08:01 crlf tests: use known-good data produced by git Given a variety of combinations of core.autocrlf settings and attributes settings, test that we check out data into the working directory the same as a known-good test resource created by git.git.
Edward Thomson bd5e59ee 2015-06-08T09:04:39 crlf: include utf8 resources in master branch Include the UTF8 and UTF8 BOM tests in the master crlf test branch for completeness.
Carlos Martín Nieto 863dd89a 2015-06-18T12:45:40 tests: tick over five seconds instead of one When ticking over one second, it can happen that the actual time ticks over the same second between the time that we undermine our own race protections and the time in which we perform the index update. Such timing would make the time in the entries match the index' timestamp and we have not gained anything. Ticking over five seconds makes it so that if real-time rolls over that second, our index is still ahead. This is still suboptimal as we're dealing with timing, but five seconds should be long enough for any reasonable test runner to finish the tests.
Pierre-Olivier Latour 85a5e8eb 2015-06-17T09:00:23 Fixed Xcode 6.1 build warnings
Edward Thomson 121c3171 2015-06-16T15:18:04 Introduce p_utimes and p_futimes Provide functionality to set the time on a filesystem entry, using utimes or futimes on POSIX type systems or SetFileTime on Win32.
Carlos Martín Nieto e44abe16 2015-06-16T08:51:45 tests: tick the index when we count OID calculations These tests want to test that we don't recalculate entries which match the index already. This is however something we force when truncating racily-clean entries. Tick the index forward as we know that we don't perform the modifications which the racily-clean code is trying to avoid.
Carlos Martín Nieto c4e6ab5f 2015-06-15T14:32:08 crlf: tick the index forward to work around racy-git behaviour In order to avoid racy-git, we zero out the file size for entries with the same timestamp as the index (or during the initial checkout). This is the case in a couple of crlf tests, as the code is fast enough to do everything in the same second. As we know that we do not perform the modification just after writing out the index, which is what this is designed to work around, tick the mtime of the index file such that it doesn't agree with the files anymore, and we do not zero out these entries.
Jeff Hostetler 26d5c0b8 2015-06-12T09:28:47 Fix leaks in tests/checkout/icase
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
Colomban Wendling 1ecbcd8e 2015-05-26T19:16:27 Fix ident replacement to match Git behavior Git inserts a space after the SHA1 (as of 2.1.4 at least), so do the same.
Carlos Martín Nieto 8f0104ec 2015-04-21T22:10:36 Remove the callbacks struct from the remote Having the setting be different from calling its actions was not a great idea and made for the sake of the wrong convenience. Instead of that, accept either fetch options, push options or the callbacks when dealing with the remote. The fetch options are currently only the callbacks, but more options will be moved from setters and getters on the remote to the options. This does mean passing the same struct along the different functions but the typical use-case will only call git_remote_fetch() or git_remote_push() and so won't notice much difference.
Edward Thomson cd79d99a 2015-04-23T15:58:53 checkout test: better case-insensitive test on Mac On Mac OS, `realpath` is deficient in determining the actual filename on-disk as it will simply provide the string you gave it if that file exists, instead of returning the filename as it exists. Instead we must read the directory entries for the parent directory to get the canonical filename.
Edward Thomson 64842d87 2015-04-23T09:21:33 checkout test: only run icase on icase platform
Edward Thomson 05f69012 2015-03-31T16:28:13 checkout: remove blocking dir when FORCEd
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.
Edward Thomson 27fa7477 2015-04-23T10:54:08 Merge pull request #3032 from jfultz/index-file-modes Fix git_checkout_tree() to do index filemodes correctly on Windows.
Edward Thomson 63af449e 2015-04-10T11:33:14 Merge pull request #3030 from linquize/symlink_supported If work_dir is not specified, use repo_dir to test if symlink is supported
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.
Linquize 7c2a2172 2015-04-04T00:29:01 Test: Create repo in while current dir is readonly and checkout symlink
Jacques Germishuys 7c2b9e06 2015-03-22T19:06:53 Illustrate bad checkout on Windows
Claudiu Olteanu 118e6fdc 2015-03-16T23:08:16 Lower case the include directive of windows header Since the Linux platform has a case sensitive file system, the header name should be lower case for cross compiling purposes. (On Linux, the mingw header is called ```windows.h```).
Carlos Martín Nieto 76f03418 2015-03-03T17:04:38 Remove swp files
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
Carlos Martín Nieto d24a5312 2015-02-12T02:34:58 Merge pull request #2866 from ethomson/checkout_perf2 Checkout performance
Edward Thomson fa89ff20 2015-02-03T05:35:24 remove some unused warnings
Edward Thomson 07c989e9 2015-02-03T20:01:24 win32: further cleanups for 8.3 disabling
Edward Thomson 5f28ec84 2015-02-03T12:16:11 win32: cleanup 8.3 disabled tests
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.
Linquize 9dcc4a36 2015-01-28T23:04:50 Fix test failures when 8.3 is disabled
Edward Thomson e0902fbc 2015-01-15T17:17:01 checkout tests: cleanup realpath impl on Win32
Edward Thomson 53eb139d 2015-01-14T20:16:01 checkout tests: emulate p_realpath poorly on Win32
Edward Thomson e74340b0 2015-01-14T18:47:00 checkout: remove files before writing new ones On case insensitive filesystems, we may have files in the working directory that case fold to a name we want to write. Remove those files (by default) so that we will not end up with a filename that has the unexpected case.
Edward Thomson 232bc895 2015-01-14T13:15:34 checkout tests: nasty symlinks Symbolic links that abuse case insensitivity to write into .git.
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.
Linquize b4c6a9da 2014-10-26T05:45:23 Add files and tests with many UTF-8 chars and few UTF-8 chars
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
Edward Thomson ec74b40c 2014-12-16T18:53:55 Introduce core.protectHFS and core.protectNTFS Validate HFS ignored char ".git" paths when `core.protectHFS` is specified. Validate NTFS invalid ".git" paths when `core.protectNTFS` is specified.
Edward Thomson 11d67b75 2014-12-10T19:12:16 checkout: disallow bad paths on HFS HFS filesystems ignore some characters like U+200C. When these characters are included in a path, they will be ignored for the purposes of comparison with other paths. Thus, if you have a ".git" folder, a folder of ".git<U+200C>" will also match. Protect our ".git" folder by ensuring that ".git<U+200C>" and friends do not match it.
Edward Thomson a64119e3 2014-11-25T18:13:00 checkout: disallow bad paths on win32 Disallow: 1. paths with trailing dot 2. paths with trailing space 3. paths with trailing colon 4. paths that are 8.3 short names of .git folders ("GIT~1") 5. paths that are reserved path names (COM1, LPT1, etc). 6. paths with reserved DOS characters (colons, asterisks, etc) These paths would (without \\?\ syntax) be elided to other paths - for example, ".git." would be written as ".git". As a result, writing these paths literally (using \\?\ syntax) makes them hard to operate with from the shell, Windows Explorer or other tools. Disallow these.
Carlos Martín Nieto f7fcb18f 2014-11-23T14:12:54 Plug leaks Valgrind is now clean except for libssl and libgcrypt.
Edward Thomson 2d24816b 2014-11-06T18:49:37 checkout_index: Remove stage 0 when checking out conflicts
Edward Thomson 9f664347 2014-11-06T14:40:21 checkout_index: remove conflicts when checking out new files
Edward Thomson 8d3b2ee3 2014-10-11T20:56:50 Introduce failing test for conflict filtering in index
Carlos Martín Nieto 0625638f 2014-10-10T17:40:53 Merge pull request #2499 from csware/hard-reset-checkout-callbacks Allow to propagate checkout callbacks to git HARD reset
Vicent Marti 14556cbf 2014-09-17T17:13:25 Merge pull request #2567 from cirosantilli/factor-41 Factor 40 and 41 constants from source.
Ciro Santilli c5cf8cad 2014-09-17T15:19:08 Replace void casts with GIT_UNUSED.
Ciro Santilli 3b2cb2c9 2014-09-16T11:49:25 Factor 40 and 41 constants from source.
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>
Vicent Marti c1bf2942 2014-07-02T15:29:25 Merge pull request #2455 from ethomson/equal_oid Introduce `cl_assert_equal_oid`
Edward Thomson 0cee70eb 2014-07-01T14:09:01 Introduce cl_assert_equal_oid
Edward Thomson f4046267 2014-06-26T09:16:12 checkout::conflict tests: only test owner mode The checkout::conflict type conflict tests were failing because they were overly assertive about the resultant mode, testing group & other bits, which failed miserably for people who had a umask less restrictive than 022. Only test the resultant owner bits.
Edward Thomson d412165f 2014-06-18T16:54:32 Update text=auto / core.autocrlf=false behavior Git for Windows 1.9.4 changed the behavior when the text=auto attribute is specified and core.autocrlf=false. Previous observed behavior would *not* filter files when going into the working directory, the new behavior *does* filter. Update our behavior to match.
Carlos Martín Nieto 5a76ad35 2014-06-19T11:45:46 crlf: pass-through mixed EOL buffers from LF->CRLF When checking out files, we're performing conversion into the user's native line endings, but we only want to do it for files which have consistent line endings. Refuse to perform the conversion for mixed-EOL files. The CRLF->LF filter is left as-is, as that conversion is considered to be normalization by git and should force a conversion of the line endings.
Ben Straub 6affd71f 2014-01-03T17:38:34 git_checkout_opts -> git_checkout_options
Edward Thomson f77127da 2014-02-09T12:37:16 Tests for core.autocrlf and .gitattributes
Ben Straub a2ce19ca 2014-02-05T13:35:26 Prevent user's merge.conflictstyle from breaking tests
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