From ff00b682f203eb39876b57404916b4c54b6032c6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 13 Jul 2011 21:36:29 -0700 Subject: reset [] 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 --- diff-lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'diff-lib.c') diff --git a/diff-lib.c b/diff-lib.c index 9c29293bbc..fd61acbdce 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; } -- cgit v1.2.3