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>
This commit is contained in:
Junio C Hamano
2011-07-13 21:36:29 -07:00
parent d28790dc31
commit ff00b682f2
3 changed files with 18 additions and 2 deletions

View File

@ -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;
}