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

Re: [RFC/PATCH] revision.c: add --format option for 'git log'

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 22, 2009, 16:49 UTC
Message-ID
<7vtz6m1knv.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1235230015-17641-1-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
> --format=:foo is a shorthand for --pretty=tformat:foo, otherwise this
> new option acts just like --pretty=foo, except it's more intuitive for
> users of 'git log'.

It's been quite a long time since the earlier discussion, but I wonder why you need the colon before "foo" for this new shorthand. I *think* you are also introducing "--format=short" as a synonym to "--pretty=short", but I do not think it is necessary.

> As discussed in the mailing list, this is implemented as an undocumented
> option.
Maybe somebody wants to document it.
Needs trivial tests.
Show 10 quoted lines
> +	} else if (!prefixcmp(arg, "--format=")) {
> +		char *modified = NULL;
> +		revs->verbose_header = 1;
> +		if (arg[9] == ':') {
> +			modified = xmalloc(strlen(arg+9) + 7 + 1);
> +			strcpy(modified, "tformat");
> +			strcat(modified, arg+9);
> +		}
> +		get_commit_format(modified ? modified : arg+9, revs);
> +		free(modified);
	struct strbuf fmt = STRBUF_INIT;
        revs->verbose_header = 1;
        strbuf_addf(&fmt, "tformat:%s", arg + 9);
        get_commit_format(fmt.buf, revs);
        strbuf_release(&fmt);
Show 5 quoted lines
>  	} else if (!strcmp(arg, "--graph")) {
>  		revs->topo_order = 1;
>  		revs->rewrite_parents = 1;
> -- 
> 1.6.1.3
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 23 in “revision.c: add --format option for 'git log'”
  1. revision.c: add --format option for 'git log'Felipe Contreras, Feb 21, 2009
  2. Junio C HamanoFeb 22, 2009
  3. Felipe ContrerasFeb 22, 2009
  4. Junio C HamanoFeb 22, 2009
  5. Junio C HamanoFeb 22, 2009
  6. Felipe ContrerasFeb 22, 2009
  7. Junio C HamanoFeb 22, 2009
  8. Felipe ContrerasFeb 22, 2009
  9. Junio C HamanoFeb 23, 2009
  10. Felipe ContrerasFeb 24, 2009
  11. Felipe ContrerasFeb 24, 2009
  12. Junio C HamanoFeb 24, 2009
  13. Nanako ShiraishiFeb 24, 2009
  14. Junio C HamanoFeb 24, 2009
  15. Felipe ContrerasFeb 24, 2009
  16. Add --format that is a synonym to --prettyNanako Shiraishi, Feb 24, 2009
  17. Jeff KingFeb 24, 2009
  18. Junio C HamanoFeb 24, 2009
  19. Jeff KingFeb 24, 2009
  20. Felipe ContrerasFeb 24, 2009
  21. Linus TorvaldsFeb 22, 2009
  22. Jakub NarebskiFeb 22, 2009
  23. Wincent ColaiutaFeb 23, 2009

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.