From: Junio C Hamano Date: Fri, 4 Apr 2008 06:01:47 +0000 (-0700) Subject: rev-list --children X-Git-Tag: v1.6.0-rc0~66^2~6^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=72276a3ecbe6353b83ab37e0ce96cc21c94cf6ee;p=git.git rev-list --children Just like --parents option shows the parents of commits, this shows the children of commits. Signed-off-by: Junio C Hamano --- diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 2648a5508..e5823950e 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -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. diff --git a/builtin-rev-list.c b/builtin-rev-list.c index edc0bd35b..9da2f7637 100644 --- a/builtin-rev-list.c +++ b/builtin-rev-list.c @@ -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" @@ -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(' ');