Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d853fb9

Browse files
Edward Thomsonethomson
authored andcommitted
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.
1 parent 8433078 commit d853fb9

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ int git_checkout_tree(
23642364
}
23652365
}
23662366

2367-
if (!(error = git_iterator_for_tree(&tree_i, tree, 0, NULL, NULL)))
2367+
if (!(error = git_iterator_for_tree(&tree_i, tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)))
23682368
error = git_checkout_iterator(tree_i, opts);
23692369

23702370
git_iterator_free(tree_i);

tests/checkout/tree.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,7 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
645645
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), -5555);
646646

647647
cl_assert(!git_path_exists("testrepo/new.txt"));
648-
649-
/* on case-insensitive FS = a/b.txt, branch_file.txt, new.txt */
650-
/* on case-sensitive FS = README, then above */
651-
652-
if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
653-
cl_assert_equal_i(3, ca.count);
654-
else
655-
cl_assert_equal_i(4, ca.count);
648+
cl_assert_equal_i(4, ca.count);
656649

657650
/* and again with a different stopping point and return code */
658651
ca.filename = "README";
@@ -662,11 +655,7 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
662655
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), 123);
663656

664657
cl_assert(!git_path_exists("testrepo/new.txt"));
665-
666-
if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
667-
cl_assert_equal_i(4, ca.count);
668-
else
669-
cl_assert_equal_i(1, ca.count);
658+
cl_assert_equal_i(1, ca.count);
670659

671660
git_object_free(obj);
672661
}

0 commit comments

Comments
 (0)