]> asedeno.scripts.mit.edu Git - git.git/blobdiff - revision.c
log --graph --left-right: show left/right information in place of '*'
[git.git] / revision.c
index c947e0fa1ea070370a4ad4c4d699b4d6ce022b61..1341f3d1259b4a5477ba15258071d0dc74ee519e 100644 (file)
@@ -416,7 +416,6 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
 {
        struct commit_list *parent = commit->parents;
        unsigned left_flag;
-       int add, rest;
 
        if (commit->object.flags & ADDED)
                return 0;
@@ -463,19 +462,18 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
 
        left_flag = (commit->object.flags & SYMMETRIC_LEFT);
 
-       rest = !revs->first_parent_only;
-       for (parent = commit->parents, add = 1; parent; add = rest) {
+       for (parent = commit->parents; parent; parent = parent->next) {
                struct commit *p = parent->item;
 
-               parent = parent->next;
                if (parse_commit(p) < 0)
                        return -1;
                p->object.flags |= left_flag;
-               if (p->object.flags & SEEN)
-                       continue;
-               p->object.flags |= SEEN;
-               if (add)
+               if (!(p->object.flags & SEEN)) {
+                       p->object.flags |= SEEN;
                        insert_by_date(p, list);
+               }
+               if(revs->first_parent_only)
+                       break;
        }
        return 0;
 }
@@ -1207,7 +1205,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                        if (!prefixcmp(arg, "--graph")) {
                                revs->topo_order = 1;
                                revs->rewrite_parents = 1;
-                               revs->graph = graph_init();
+                               revs->graph = graph_init(revs);
                                continue;
                        }
                        if (!strcmp(arg, "--root")) {