read-tree: reorganize bind_merge code.
This does not change the logic but moves the order of checks around so that merging of read-tree safety code would become easier. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
May 17, 2006 at 03:16 UTC
d6970e42a1763b549ccf93558de7f54a78819d7a
1 file changed
+6
-6
read-tree.c
+6
-6
@@ -683,7 +683,7 @@ static int twoway_merge(struct cache_entry **src)
683
* Bind merge.
684
*
685
* Keep the index entries at stage0, collapse stage1 but make sure
686
- * stage0 does not have anything in prefix.
686
+ * stage0 does not have anything there.
687
*/
688
static int bind_merge(struct cache_entry **src)
689
{
@@ -693,12 +693,12 @@ static int bind_merge(struct cache_entry **src)
693
if (merge_size != 1)
694
return error("Cannot do a bind merge of %d trees\n",
695
merge_size);
696
- if (!a)
697
- return merged_entry(old, NULL);
698
- if (old)
696
+ if (a && old)
697
die("Entry '%s' overlaps. Cannot bind.", a->name);
700
-
701
- return merged_entry(a, NULL);
698
+ if (!a)
699
+ return keep_entry(old);
700
+ else
701
+ return merged_entry(a, NULL);
702
}
703
704
/*