Skip to content

Commit

Permalink
Merge branch 'jc/fpl'
Browse files Browse the repository at this point in the history
* jc/fpl:
  git-log --first-parent: show only the first parent log
  • Loading branch information
Junio C Hamano committed Mar 26, 2007
2 parents 620d3f4 + 0053e90 commit 3a81b9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ struct rev_info {
boundary:2,
left_right:1,
parents:1,
reverse:1;
reverse:1,
first_parent_only:1;

/* Diff flags */
unsigned int diff:1,
Expand Down

0 comments on commit 3a81b9f

Please sign in to comment.