From 5eda906b2873c986fa61406dafb6acd99e70d540 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Fri, 24 Jul 2015 15:08:03 -0700
Subject: [PATCH] rerere: handle conflicts with multiple stage #1 entries

A conflicted index can have multiple stage #1 entries when dealing
with a criss-cross merge and using the "resolve" merge strategy.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 rerere.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rerere.c b/rerere.c
index e307711f817..b453a80085a 100644
--- a/rerere.c
+++ b/rerere.c
@@ -369,7 +369,7 @@ static int check_one_conflict(int i, int *type)
 	}
 
 	*type = PUNTED;
-	if (ce_stage(e) == 1)
+	while (ce_stage(active_cache[i]) == 1)
 		i++;
 
 	/* Only handle regular files with both stages #2 and #3 */