From: Johannes Sixt Date: Fri, 30 Jan 2026 09:55:39 GMT Subject: Re: [PATCH v2] t/perf/p3400: speed up setup using fast-import Message-ID: In-Reply-To: <04005f67-3ec5-4fa7-9fd7-37ef9034286a@kdbg.org> Am 30.01.26 um 07:41 schrieb Johannes Sixt: > Am 28.01.26 um 17:07 schrieb Tian Yuchen: >> + >> + ( >> + 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. I am wrong here, because my earlier tests were too narrow. This use of `return` actually does work as intended, because it happens inside a function. Neither the subshell nor being in the upstream of a pipe negates this fact. The rest of the comment still stands, though. > 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? > >> + done >> + ) | git fast-import && -- Hannes