summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tree.c b/src/tree.c
index ec57e8bb8..11123a18a 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -566,6 +566,7 @@ int git_tree__write_index(
git_oid *oid, git_index *index, git_repository *repo)
{
int ret;
+ bool old_ignore_case = false;
assert(oid && index && repo);
@@ -580,8 +581,21 @@ int git_tree__write_index(
return 0;
}
- /* The tree cache didn't help us */
+ /* The tree cache didn't help us; we'll have to write
+ * out a tree. If the index is ignore_case, we must
+ * make it case-sensitive for the duration of the tree-write
+ * operation. */
+
+ if (index->ignore_case) {
+ old_ignore_case = true;
+ git_index__set_ignore_case(index, false);
+ }
+
ret = write_tree(oid, repo, index, "", 0);
+
+ if (old_ignore_case)
+ git_index__set_ignore_case(index, true);
+
return ret < 0 ? ret : 0;
}