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

Re: [PATCH v2] t/perf/p3400: speed up setup using fast-import

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 30, 2026, 16:27 UTC
Message-ID
<xmqqcy2r83rx.fsf@gitster.g>
In-Reply-To
<04005f67-3ec5-4fa7-9fd7-37ef9034286a@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 7 quoted lines
> Am 28.01.26 um 17:07 schrieb Tian Yuchen:
>> +	test_seq 1000 >content_fwd &&
>> +	test_seq 1000 | sort -nr >content_rev &&
>
> Remove another pipe with
>
> 	sort -nr content_fwd >content_rev &&

I agree with the outcome (i.e., we do not run test_seq twice) but not necessarily with the motivation (i.e., we do not assume test_seq may fail and care about its failure code, so no need to avoid pipes for the sake of avoiding pipes).

Show 9 quoted lines
>> +	(
>> +		for i in $(test_seq 100)
>> +		do
>> +			...
>> +			cat content_rev &&
>> +			echo "EOF" || return 1
>
> This is an incorrect use of `return` outside a function. This must be
> `|| exit 1` (or just `|| exit`) to actually break out of the loop.
Good.
Show 8 quoted lines
> Of course, the error code is ignored, because it is in the upstream of a
> pipe, so in order to fail the complete command, it would be necessary
> that the original error left an incorrect fast-import stream such that
> the down-stream `git fast-import` fails. Otherwise, the entire command
> can complete successfully in an unexpected way.
>
> Maybe instead of a pipe, dump the stream into a temporary file, so that
> the loop's exit code can be captured?

I like this suggestion. A temporary file, unless it is excessively large, has an additional advantage that it allows you to inspect after "git fast-import" dies on it.

>> +		done
>> +	) | git fast-import &&
> -- Hannes
Previous: Johannes SixtNext: Phillip Wood
Message 8 of 14 in “[RFC] t/perf/p3400: speed up setup using fast-import”
  1. [RFC] t/perf/p3400: speed up setup using fast-importTian Yuchen, Jan 26, 2026
  2. Tian YuchenJan 26, 2026
  3. Tian YuchenJan 28, 2026
  4. Tian YuchenJan 28, 2026
  5. t/perf/p3400: speed up setup using fast-importTian Yuchen, Jan 28, 2026
  6. Johannes SixtJan 30, 2026
  7. Johannes SixtJan 30, 2026
  8. Junio C HamanoJan 30, 2026
  9. Phillip WoodJan 30, 2026
  10. Tian YuchenJan 30, 2026
  11. t/perf/p3400: speed up setup using fast-importTian Yuchen, Jan 30, 2026
  12. t/perf/p3400: speed up setup using fast-importTian Yuchen, Jan 30, 2026
  13. Junio C HamanoJan 30, 2026
  14. Johannes SixtJan 30, 2026

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.