unpack-trees: don't perform any index operation if we're not merging
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Tue, 10 Apr 2012 18:55:58 +0000 (20:55 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Apr 2012 23:36:18 +0000 (16:36 -0700)
src[0] points to the index entry in the merge case and to the first
tree to unpack in the non-merge case.  We only want to mark the index
entry, so check first if we're merging.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c

index 7c9ecf665d062d79e9208875d9bf2577e98f4fb2..60b728e4958261da4a9a99f46bce4fab308e5772 100644 (file)
@@ -772,7 +772,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
        if (unpack_nondirectories(n, mask, dirmask, src, names, info) < 0)
                return -1;
 
-       if (src[0]) {
+       if (o->merge && src[0]) {
                if (ce_stage(src[0]))
                        mark_ce_used_same_name(src[0], o);
                else