summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2013-03-01 15:44:18 -0500
committerPhilip Kelley <phkelley@hotmail.com>2013-03-01 15:46:21 -0500
commit3f0d0c85d06f0d5ff9ba469c6ab523bfddcc710b (patch)
tree40812383a2ae1d05788c71974d31eb86ca12ba99 /src/tree.c
parent426b2e2fce17b09203f00e013e173328f50fd9e8 (diff)
downloadlibgit2-3f0d0c85d06f0d5ff9ba469c6ab523bfddcc710b.tar.gz
Disable ignore_case when writing the index to a tree
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..decd37e71 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'll 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;
}