rerere: teach rerere to handle nested conflicts
[gitweb.git] / rerere.c
index a35b88916c45eca6f07267f6da93eaee13506220..f78bef80b1119d72810f4424196cb55f8d30f11d 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -365,12 +365,18 @@ static int handle_conflict(struct strbuf *out, struct rerere_io *io,
                RR_SIDE_1 = 0, RR_SIDE_2, RR_ORIGINAL
        } hunk = RR_SIDE_1;
        struct strbuf one = STRBUF_INIT, two = STRBUF_INIT;
-       struct strbuf buf = STRBUF_INIT;
+       struct strbuf buf = STRBUF_INIT, conflict = STRBUF_INIT;
        int has_conflicts = -1;
 
        while (!io->getline(&buf, io)) {
                if (is_cmarker(buf.buf, '<', marker_size)) {
-                       break;
+                       if (handle_conflict(&conflict, io, marker_size, NULL) < 0)
+                               break;
+                       if (hunk == RR_SIDE_1)
+                               strbuf_addbuf(&one, &conflict);
+                       else
+                               strbuf_addbuf(&two, &conflict);
+                       strbuf_release(&conflict);
                } else if (is_cmarker(buf.buf, '|', marker_size)) {
                        if (hunk != RR_SIDE_1)
                                break;