summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-13 15:32:09 -0700
committerRussell Belfer <rb@github.com>2013-06-17 10:03:49 -0700
commita3e8dbb40b87f66e1f5f4d1730f9989805822db0 (patch)
tree0e88ea878d5d0b75c4e4f88afff2a38b754756f6
parent3a68d7f00289afbaa415c3b34d5eeca183dcfb52 (diff)
downloadlibgit2-a3e8dbb40b87f66e1f5f4d1730f9989805822db0.tar.gz
Be more careful about the path with diffs
This makes diff more careful about picking the canonical path when generating a delta so that it won't accidentally pick up a case-mismatched path on a case-insensitive file system. This should make sure we use the "most accurate" case correct version of the path (i.e. from the tree if possible, or the index if need be).
-rw-r--r--src/diff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index 3bfe149e3..feb77b59b 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -134,6 +134,7 @@ static int diff_delta__from_two(
{
git_diff_delta *delta;
int notify_res;
+ const char *canonical_path = old_entry->path;
if (status == GIT_DELTA_UNMODIFIED &&
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNMODIFIED))
@@ -153,7 +154,7 @@ static int diff_delta__from_two(
new_mode = temp_mode;
}
- delta = diff_delta__alloc(diff, status, old_entry->path);
+ delta = diff_delta__alloc(diff, status, canonical_path);
GITERR_CHECK_ALLOC(delta);
git_oid_cpy(&delta->old_file.oid, &old_entry->oid);