aboutsummaryrefslogtreecommitdiff
path: root/builtin/reset.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-13 21:36:29 -0700
committerJunio C Hamano <gitster@pobox.com>2011-07-13 21:39:18 -0700
commitff00b682f203eb39876b57404916b4c54b6032c6 (patch)
tree02a3db584eb73b44ccd2a4e719c77ca0ed2690e1 /builtin/reset.c
parentd28790dc31ca1bcdca7254a6b9381b6c84e91271 (diff)
downloadgit-ff00b682f203eb39876b57404916b4c54b6032c6.tar.gz
git-ff00b682f203eb39876b57404916b4c54b6032c6.tar.xz
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 'builtin/reset.c')
-rw-r--r--builtin/reset.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index 98bca044c..777e7c612 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -162,7 +162,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
for (i = 0; i < q->nr; i++) {
struct diff_filespec *one = q->queue[i]->one;
- if (one->mode) {
+ if (one->mode && !is_null_sha1(one->sha1)) {
struct cache_entry *ce;
ce = make_cache_entry(one->mode, one->sha1, one->path,
0, 0);