Skip to content

Commit 91b849b

Browse files
jaysoffiangitster
authored andcommitted
log --children
Teach git-log to support --children, which was added by f35f560 to the revision machinery, and by 72276a3 to rev-list, but was never added to git-log. Signed-off-by: Jay Soffian <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e923eae commit 91b849b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

log-tree.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ static void show_parents(struct commit *commit, int abbrev)
5656
}
5757
}
5858

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+
5967
void show_decorations(struct rev_info *opt, struct commit *commit)
6068
{
6169
const char *prefix;
@@ -303,6 +311,8 @@ void show_log(struct rev_info *opt)
303311
fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
304312
if (opt->print_parents)
305313
show_parents(commit, abbrev_commit);
314+
if (opt->children.name)
315+
show_children(opt, commit, abbrev_commit);
306316
show_decorations(opt, commit);
307317
if (opt->graph && !graph_is_commit_finished(opt->graph)) {
308318
putchar('\n');
@@ -372,6 +382,8 @@ void show_log(struct rev_info *opt)
372382
stdout);
373383
if (opt->print_parents)
374384
show_parents(commit, abbrev_commit);
385+
if (opt->children.name)
386+
show_children(opt, commit, abbrev_commit);
375387
if (parent)
376388
printf(" (from %s)",
377389
find_unique_abbrev(parent->object.sha1,

0 commit comments

Comments
 (0)