log --children
Teach git-log to support --children, which was added by f35f5603f4 to the revision machinery, and by 72276a3ecb to rev-list, but was never added to git-log. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jay Soffian committed
Oct 4, 2011 at 10:02 UTC
91b849b273a7f3786d8cac569352aaa8bca7b46c
1 file changed
+12
log-tree.c
+12
@@ -56,6 +56,14 @@ static void show_parents(struct commit *commit, int abbrev)
56
}
57
}
58
59
+static void show_children(struct rev_info *opt, struct commit *commit, int abbrev)
60
+{
61
+ struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
62
+ for ( ; p; p = p->next) {
63
+ printf(" %s", find_unique_abbrev(p->item->object.sha1, abbrev));
64
+ }
65
+}
66
+
67
void show_decorations(struct rev_info *opt, struct commit *commit)
68
{
69
const char *prefix;
@@ -303,6 +311,8 @@ void show_log(struct rev_info *opt)
311
fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
312
if (opt->print_parents)
313
show_parents(commit, abbrev_commit);
314
+ if (opt->children.name)
315
+ show_children(opt, commit, abbrev_commit);
316
show_decorations(opt, commit);
317
if (opt->graph && !graph_is_commit_finished(opt->graph)) {
318
putchar('\n');
@@ -372,6 +382,8 @@ void show_log(struct rev_info *opt)
382
stdout);
383
if (opt->print_parents)
384
show_parents(commit, abbrev_commit);
385
+ if (opt->children.name)
386
+ show_children(opt, commit, abbrev_commit);
387
if (parent)
388
printf(" (from %s)",
389
find_unique_abbrev(parent->object.sha1,