Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-14 02:52:12 +0400
committerRussell Belfer <rb@github.com>2013-06-17 21:03:49 +0400
commit6ea999bb88e1c5d0be17d823c23728d11adfed47 (patch)
tree84101d2fd2182f6f7294d248ec017c1dd20e84b6 /src/index.c
parent1540b19990fa5c566d607785c7b3651756e706ff (diff)
Make index_insert keep existing case
In a case insensitive index, if you attempt to add a file from disk with a different case pattern, the old case pattern in the index should be preserved. This fixes that (and a couple of minor warnings).
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c
index 4f0c70135..560a257e7 100644
--- a/src/index.c
+++ b/src/index.c
@@ -734,8 +734,9 @@ static int index_insert(git_index *index, git_index_entry *entry, int replace)
if (!replace || !existing)
return git_vector_insert(&index->entries, entry);
- /* exists, replace it */
- git__free((*existing)->path);
+ /* exists, replace it (preserving name from existing entry) */
+ git__free(entry->path);
+ entry->path = (*existing)->path;
git__free(*existing);
*existing = entry;