Skip to content

Commit

Permalink
read-tree: reorganize bind_merge code.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed May 17, 2006
1 parent 6bd2035 commit d6970e4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions read-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ static int twoway_merge(struct cache_entry **src)
* Bind merge.
*
* Keep the index entries at stage0, collapse stage1 but make sure
* stage0 does not have anything in prefix.
* stage0 does not have anything there.
*/
static int bind_merge(struct cache_entry **src)
{
Expand All @@ -693,12 +693,12 @@ static int bind_merge(struct cache_entry **src)
if (merge_size != 1)
return error("Cannot do a bind merge of %d trees\n",
merge_size);
if (!a)
return merged_entry(old, NULL);
if (old)
if (a && old)
die("Entry '%s' overlaps. Cannot bind.", a->name);

return merged_entry(a, NULL);
if (!a)
return keep_entry(old);
else
return merged_entry(a, NULL);
}

/*
Expand Down

0 comments on commit d6970e4

Please sign in to comment.