diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-05-21 14:15:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-05-21 14:15:52 -0700 |
commit | f0abea652bf90c5a081f07e35c4a656143e0ec50 (patch) | |
tree | c938575a030144daf16315ebc1516440f3c18d19 | |
parent | 1fe82d609f9a6ec146fa39880a04e11eb5275810 (diff) | |
parent | ad1012ebde8be471098b5d476a98a02c76c8e75a (diff) | |
download | git-f0abea652bf90c5a081f07e35c4a656143e0ec50.tar.gz |
Merge branch 'sv/first-parent'
* sv/first-parent:
revision.c: really honor --first-parent
Simplify and fix --first-parent implementation
-rw-r--r-- | revision.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/revision.c b/revision.c index c947e0fa1e..7142cf96cd 100644 --- a/revision.c +++ b/revision.c @@ -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; } |