revision.c: really honor --first-parent
authorLars Hjemli <hjemli@gmail.com>
Mon, 12 May 2008 15:12:36 +0000 (17:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 May 2008 23:24:51 +0000 (16:24 -0700)
In add_parents_to_list, if any parent of a revision had already been
SEEN, the current code would continue with the next parent, skipping
the test for --first-parent. This patch inverts the test for SEEN so
that the test for --first-parent is always performed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c

index bcfcd2a82bb06cd565cf5d20fea3fc0a25da2242..6f5b548a32cd406523cf1aaca8eaa6147bd55b16 100644 (file)
@@ -467,10 +467,10 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
                if (parse_commit(p) < 0)
                        return -1;
                p->object.flags |= left_flag;
-               if (p->object.flags & SEEN)
-                       continue;
-               p->object.flags |= SEEN;
-               insert_by_date(p, list);
+               if (!(p->object.flags & SEEN)) {
+                       p->object.flags |= SEEN;
+                       insert_by_date(p, list);
+               }
                if(revs->first_parent_only)
                        break;
        }