summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/checkout.c2
-rw-r--r--tests/checkout/tree.c15
3 files changed, 6 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b01f48138..1ea961879 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -145,3 +145,6 @@ v0.21 + 1
* git_treebuilder_create now takes a repository so that it can query
repository configuration. Subsequently, git_treebuilder_write no
longer takes a repository.
+
+* git_checkout now handles case-changing renames correctly on
+ case-insensitive filesystems; for example renaming "readme" to "README".
diff --git a/src/checkout.c b/src/checkout.c
index a3a46011e..45e02e956 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -2474,7 +2474,7 @@ int git_checkout_tree(
if ((error = git_repository_index(&index, repo)) < 0)
return error;
- if (!(error = git_iterator_for_tree(&tree_i, tree, 0, NULL, NULL)))
+ if (!(error = git_iterator_for_tree(&tree_i, tree, GIT_ITERATOR_DONT_IGNORE_CASE, 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 70905b843..da3c00d3c 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -645,14 +645,7 @@ 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"));
-
- /* 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);
+ cl_assert_equal_i(4, ca.count);
/* and again with a different stopping point and return code */
ca.filename = "README";
@@ -662,11 +655,7 @@ 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"));
-
- if (git_path_exists("testrepo/.git/CoNfIg")) /* case insensitive */
- cl_assert_equal_i(4, ca.count);
- else
- cl_assert_equal_i(1, ca.count);
+ cl_assert_equal_i(1, ca.count);
git_object_free(obj);
}