summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2011-10-04 10:02:03 -0400
committerJunio C Hamano <gitster@pobox.com>2011-10-04 10:27:48 -0700
commit91b849b273a7f3786d8cac569352aaa8bca7b46c (patch)
treece5bbad96c7821504755d5dfb9ae16de8e83e62c
parente923eaeb901ff056421b9007adcbbce271caa7b6 (diff)
downloadgit-91b849b273a7f3786d8cac569352aaa8bca7b46c.tar.gz
log --childrenjs/log-show-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>
-rw-r--r--log-tree.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/log-tree.c b/log-tree.c
index 27afcf6972..98387ad533 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -56,6 +56,14 @@ static void show_parents(struct commit *commit, int abbrev)
}
}
+static void show_children(struct rev_info *opt, struct commit *commit, int abbrev)
+{
+ struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
+ for ( ; p; p = p->next) {
+ printf(" %s", find_unique_abbrev(p->item->object.sha1, abbrev));
+ }
+}
+
void show_decorations(struct rev_info *opt, struct commit *commit)
{
const char *prefix;
@@ -303,6 +311,8 @@ void show_log(struct rev_info *opt)
fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
if (opt->print_parents)
show_parents(commit, abbrev_commit);
+ if (opt->children.name)
+ show_children(opt, commit, abbrev_commit);
show_decorations(opt, commit);
if (opt->graph && !graph_is_commit_finished(opt->graph)) {
putchar('\n');
@@ -372,6 +382,8 @@ void show_log(struct rev_info *opt)
stdout);
if (opt->print_parents)
show_parents(commit, abbrev_commit);
+ if (opt->children.name)
+ show_children(opt, commit, abbrev_commit);
if (parent)
printf(" (from %s)",
find_unique_abbrev(parent->object.sha1,