Revert "Always checkout with case sensitive iterator" This reverts commit 40d791545abfb3cb71553a27dc64129e1a9bec28.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/src/checkout.c b/src/checkout.c
index 4781308..b70ea18 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -2643,7 +2643,7 @@ int git_checkout_tree(
if ((error = git_repository_index(&index, repo)) < 0)
return error;
- if (!(error = git_iterator_for_tree(&tree_i, tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)))
+ if (!(error = git_iterator_for_tree(&tree_i, tree, 0, NULL, NULL)))
error = git_checkout_iterator(tree_i, index, opts);
git_iterator_free(tree_i);
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 7b0eae4..3bc9c93 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -646,7 +646,14 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), -5555);
cl_assert(!git_path_exists("testrepo/new.txt"));
- cl_assert_equal_i(4, ca.count);
+
+ /* on case-insensitive FS = a/b.txt, branch_file.txt, new.txt */
+ /* on case-sensitive FS = README, then above */
+
+ if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
+ cl_assert_equal_i(3, ca.count);
+ else
+ cl_assert_equal_i(4, ca.count);
/* and again with a different stopping point and return code */
ca.filename = "README";
@@ -656,7 +663,11 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
cl_git_fail_with(git_checkout_tree(g_repo, obj, &opts), 123);
cl_assert(!git_path_exists("testrepo/new.txt"));
- cl_assert_equal_i(1, ca.count);
+
+ if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
+ cl_assert_equal_i(4, ca.count);
+ else
+ cl_assert_equal_i(1, ca.count);
git_object_free(obj);
}