summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-14 04:36:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-07-14 04:39:18 (GMT)
commitff00b682f203eb39876b57404916b4c54b6032c6 (patch)
tree02a3db584eb73b44ccd2a4e719c77ca0ed2690e1 /diff-lib.c
parentd28790dc31ca1bcdca7254a6b9381b6c84e91271 (diff)
downloadgit-ff00b682f203eb39876b57404916b4c54b6032c6.zip
git-ff00b682f203eb39876b57404916b4c54b6032c6.tar.gz
git-ff00b682f203eb39876b57404916b4c54b6032c6.tar.bz2
reset [<commit>] paths...: do not mishandle unmerged paths
Because "diff --cached HEAD" showed an incorrect blob object name on the LHS of the diff, we ended up updating the index entry with bogus value, not what we read from the tree. Noticed by John Nowak. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 9c29293..fd61acb 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -379,7 +379,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
if (cached && idx && ce_stage(idx)) {
struct diff_filepair *pair;
pair = diff_unmerge(&revs->diffopt, idx->name);
- fill_filespec(pair->one, idx->sha1, idx->ce_mode);
+ if (tree)
+ fill_filespec(pair->one, tree->sha1, tree->ce_mode);
return;
}