rev-list --children
authorJunio C Hamano <gitster@pobox.com>
Fri, 4 Apr 2008 06:01:47 +0000 (23:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 13 Apr 2008 02:41:29 +0000 (19:41 -0700)
Just like --parents option shows the parents of commits, this shows the
children of commits.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/rev-list-options.txt
builtin-rev-list.c

index 2648a550850bf07128e4a0a14c82860d6bad17b8..e5823950e2a199a0ee4853147dd687d18f0c4387 100644 (file)
@@ -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.
 
index edc0bd35bb0e96a230284250dc4c40776cf7caac..9da2f76375ee0160a554d691c714446146e1b1cf 100644 (file)
@@ -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(' ');