git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] log --children

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 4, 2011, 20:12 UTC
Message-ID
<4E8B68AC.7020009@drmicha.warpmail.net>
In-Reply-To
<1317736923-20539-1-git-send-email-jaysoffian@gmail.com>
Jay Soffian venit, vidit, dixit 04.10.2011 16:02:
Show 34 quoted lines
> 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>
> ---
>  log-tree.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/log-tree.c b/log-tree.c
> index 24c295ea1d..e7694a3a4c 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -165,6 +165,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;
> @@ -414,6 +422,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);

That means that "log --children --parents" will print out the parents' sha1s, then the children's. Is that a good default format, or should we somehow deal with the case when both are specified?

Show 12 quoted lines
>  		show_decorations(opt, commit);
>  		if (opt->graph && !graph_is_commit_finished(opt->graph)) {
>  			putchar('\n');
> @@ -473,6 +483,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,
And I guess we would like to test this...
Michael
Previous: Jay SoffianNext: Junio C Hamano
Message 2 of 6 in “log --children”
  1. log --childrenJay Soffian, Oct 4, 2011
  2. Michael J GruberOct 4, 2011
  3. Junio C HamanoOct 4, 2011
  4. Michael J GruberOct 4, 2011
  5. log --childrenJay Soffian, Oct 4, 2011
  6. Michael J GruberOct 4, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.