Skip to content

Commit

Permalink
rev-list --children
Browse files Browse the repository at this point in the history
Just like --parents option shows the parents of commits, this shows the
children of commits.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Apr 13, 2008
1 parent f35f560 commit 72276a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ format, often found in E-mail messages.

Print the parents of the commit.

--children::

Print the children of the commit.

--timestamp::
Print the raw commit timestamp.

Expand Down
10 changes: 10 additions & 0 deletions builtin-rev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static const char rev_list_usage[] =
" --reverse\n"
" formatting output:\n"
" --parents\n"
" --children\n"
" --objects | --objects-edge\n"
" --unpacked\n"
" --header | --pretty\n"
Expand Down Expand Up @@ -84,6 +85,15 @@ static void show_commit(struct commit *commit)
parents = parents->next;
}
}
if (revs.children.name) {
struct commit_list *children;

children = lookup_decoration(&revs.children, &commit->object);
while (children) {
printf(" %s", sha1_to_hex(children->item->object.sha1));
children = children->next;
}
}
show_decorations(commit);
if (revs.commit_format == CMIT_FMT_ONELINE)
putchar(' ');
Expand Down

0 comments on commit 72276a3

Please sign in to comment.