From 52aaf649cb70134090c3e3a762bed730d5451c17 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 9 Jul 2007 14:47:24 +0100 Subject: rerere: record resolution even if file is not in merge base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two-file merges were rare enough that they were dropped outside of the radar. This fix is a trivial change to builtin-rerere.c::find_conflict(). It is still sane to insist that we do not do rerere for symlinks, and require to have stages #2 and #3, but we can drop the requirement to have stage #1. rerere does not use information from there anyway. This fix is from Junio, together with two tests to verify that it works as expected. Acked-by: Uwe Kleine-König Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- builtin-rerere.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'builtin-rerere.c') diff --git a/builtin-rerere.c b/builtin-rerere.c index c25b3d5586..6ffc43d864 100644 --- a/builtin-rerere.c +++ b/builtin-rerere.c @@ -168,19 +168,16 @@ static int find_conflict(struct path_list *conflict) int i; if (read_cache() < 0) return error("Could not read index"); - for (i = 0; i + 2 < active_nr; i++) { - struct cache_entry *e1 = active_cache[i]; - struct cache_entry *e2 = active_cache[i+1]; - struct cache_entry *e3 = active_cache[i+2]; - if (ce_stage(e1) == 1 && - ce_stage(e2) == 2 && + for (i = 0; i+1 < active_nr; i++) { + struct cache_entry *e2 = active_cache[i]; + struct cache_entry *e3 = active_cache[i+1]; + if (ce_stage(e2) == 2 && ce_stage(e3) == 3 && - ce_same_name(e1, e2) && ce_same_name(e1, e3) && - S_ISREG(ntohl(e1->ce_mode)) && + ce_same_name(e2, e3) && S_ISREG(ntohl(e2->ce_mode)) && S_ISREG(ntohl(e3->ce_mode))) { - path_list_insert((const char *)e1->name, conflict); - i += 2; + path_list_insert((const char *)e2->name, conflict); + i++; /* skip over both #2 and #3 */ } } return 0; -- cgit v1.2.3