aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-03-25 17:47:07 -0700
committerJunio C Hamano <junkio@cox.net>2007-03-25 17:47:07 -0700
commit3a81b9f571a6b7edd83b3d5f27c3c95d9b1c9d5c (patch)
tree77598ab3f870d3d22d68c11e4d453ad3aa91a0ee /revision.c
parent620d3f4216e5a9cf29f1de8c91ea5380e766238c (diff)
parent0053e902b4f777ba454b62263d3695e5292b1559 (diff)
downloadgit-3a81b9f571a6b7edd83b3d5f27c3c95d9b1c9d5c.tar.gz
git-3a81b9f571a6b7edd83b3d5f27c3c95d9b1c9d5c.tar.xz
Merge branch 'jc/fpl'
* jc/fpl: git-log --first-parent: show only the first parent log
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/revision.c b/revision.c
index adc381c26..f23c1d522 100644
--- a/revision.c
+++ b/revision.c
@@ -360,6 +360,7 @@ static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
{
struct commit_list *parent = commit->parents;
unsigned left_flag;
+ int add, rest;
if (commit->object.flags & ADDED)
return;
@@ -405,18 +406,19 @@ static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
return;
left_flag = (commit->object.flags & SYMMETRIC_LEFT);
- parent = commit->parents;
- while (parent) {
+
+ rest = !revs->first_parent_only;
+ for (parent = commit->parents, add = 1; parent; add = rest) {
struct commit *p = parent->item;
parent = parent->next;
-
parse_commit(p);
p->object.flags |= left_flag;
if (p->object.flags & SEEN)
continue;
p->object.flags |= SEEN;
- insert_by_date(p, list);
+ if (add)
+ insert_by_date(p, list);
}
}
@@ -847,6 +849,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_all(revs, flags);
continue;
}
+ if (!strcmp(arg, "--first-parent")) {
+ revs->first_parent_only = 1;
+ continue;
+ }
if (!strcmp(arg, "--reflog")) {
handle_reflog(revs, flags);
continue;