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

Re: [PATCH] pretty: lazy-load commit data when expanding user-format

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 28, 2021, 22:36 UTC
Message-ID
<87eei4pu3c.fsf@evledraar.gmail.com>
In-Reply-To
<YBMXM83xCZvC5WyA@coredump.intra.peff.net>
On Thu, Jan 28 2021, Jeff King wrote:
Show 11 quoted lines
>   # using git.git as the test repo
>   Test                          HEAD^             HEAD
>   ----------------------------------------------------------------------
>   4205.1: log with %H           0.40(0.39+0.01)   0.03(0.02+0.01) -92.5%
>   4205.2: log with %h           0.45(0.44+0.01)   0.09(0.09+0.00) -80.0%
>   4205.3: log with %T           0.40(0.39+0.00)   0.04(0.04+0.00) -90.0%
>   4205.4: log with %t           0.46(0.46+0.00)   0.09(0.08+0.01) -80.4%
>   4205.5: log with %P           0.39(0.39+0.00)   0.03(0.03+0.00) -92.3%
>   4205.6: log with %p           0.46(0.46+0.00)   0.10(0.09+0.00) -78.3%
>   4205.7: log with %h-%h-%h     0.52(0.51+0.01)   0.15(0.14+0.00) -71.2%
>   4205.8: log with %an-%ae-%s   0.42(0.41+0.00)   0.42(0.41+0.01) +0.0%
Looks nice!
Show 13 quoted lines
> diff --git a/t/perf/p4205-log-pretty-formats.sh b/t/perf/p4205-log-pretty-formats.sh
> index 7c26f4f337..609fecd65d 100755
> --- a/t/perf/p4205-log-pretty-formats.sh
> +++ b/t/perf/p4205-log-pretty-formats.sh
> @@ -6,7 +6,7 @@ test_description='Tests the performance of various pretty format placeholders'
>  
>  test_perf_default_repo
>  
> -for format in %H %h %T %t %P %p %h-%h-%h
> +for format in %H %h %T %t %P %p %h-%h-%h %an-%ae-%s
>  do
>  	test_perf "log with $format" "
>  		git log --format=\"$format\" >/dev/null

While we're at it it would be nice to have a few more formats that have to do with the body in some way in those tests, and stess things like mailmap/trailers etc.

    %s
    %b
    %B
    %N
    %aN-%aE
    %cn-%ce
    %cN-%cE
    %d
    %D
    %(trailers)

Just paging over the git-log manpage, that seems to stress most of the codepaths, i.e. subject/body, but also things like notes, .mailmap, ref names, and body parsing (trailers).

Previous: Jeff KingNext: Jeff King
Message 2 of 5 in “pretty: lazy-load commit data when expanding user-format”
  1. pretty: lazy-load commit data when expanding user-formatJeff King, Jan 28, 2021
  2. Ævar Arnfjörð BjarmasonJan 28, 2021
  3. Jeff KingJan 29, 2021
  4. Taylor BlauJan 28, 2021
  5. Junio C HamanoJan 28, 2021

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.