diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-03-27 15:33:44 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-05-04 07:18:25 -0500 |
commit | 431f98070f7494cabad2d1b674dfbcdafccd30b1 (patch) | |
tree | af49d1e752670a0c11b3bbdc59c65a788bf62942 | |
parent | cfc2e56d59db3d0d2b58aeffc4ef4640b7f846b5 (diff) | |
download | libgit2-431f98070f7494cabad2d1b674dfbcdafccd30b1.tar.gz |
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.
-rw-r--r-- | tests/checkout/tree.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 3973d9320..46e8b0f90 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -1327,3 +1327,25 @@ void test_checkout_tree__safe_proceeds_if_no_index(void) git_object_free(obj); } +void test_checkout_tree__ignores_unstaged_casechange(void) +{ + git_reference *orig_ref, *br2_ref; + git_commit *orig, *br2; + git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; + + checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE; + + cl_git_pass(git_reference_lookup_resolved(&orig_ref, g_repo, "HEAD", 100)); + cl_git_pass(git_commit_lookup(&orig, g_repo, git_reference_target(orig_ref))); + cl_git_pass(git_reset(g_repo, (git_object *)orig, GIT_RESET_HARD, NULL)); + + cl_rename("testrepo/branch_file.txt", "testrepo/Branch_File.txt"); + + cl_git_pass(git_reference_lookup_resolved(&br2_ref, g_repo, "refs/heads/br2", 100)); + cl_git_pass(git_commit_lookup(&br2, g_repo, git_reference_target(br2_ref))); + + cl_git_pass(git_checkout_tree(g_repo, (const git_object *)br2, &checkout_opts)); + + git_commit_free(orig); + git_reference_free(orig_ref); +} |