diff options
author | Junio C Hamano <junkio@cox.net> | 2006-05-17 03:16:27 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-05-17 03:16:27 -0700 |
commit | d6970e42a1763b549ccf93558de7f54a78819d7a (patch) | |
tree | a4bdf853fea47a89c27507f1b6999498417f30db /read-tree.c | |
parent | write-tree: --prefix=<path> (diff) | |
download | tgif-d6970e42a1763b549ccf93558de7f54a78819d7a.tar.xz |
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>
Diffstat (limited to 'read-tree.c')
-rw-r--r-- | read-tree.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/read-tree.c b/read-tree.c index 8b91affe89..fb1d6829d9 100644 --- a/read-tree.c +++ b/read-tree.c @@ -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) { @@ -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); } /* |