public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg•org>
To: Tian Yuchen <a3205153416@gmail•com>
Cc: gitster@pobox•com, git@vger•kernel.org
Subject: Re: [PATCH v2] t/perf/p3400: speed up setup using fast-import
Date: Fri, 30 Jan 2026 10:55:39 +0100	[thread overview]
Message-ID: <edc47d68-7e34-49af-b719-cef3076f6eeb@kdbg.org> (raw)
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


  reply	other threads:[~2026-01-30  9:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 16:56 [PATCH V1][RFC] t/perf/p3400: speed up setup using fast-import Tian Yuchen
2026-01-26 17:06 ` Tian Yuchen
2026-01-28  4:33   ` Tian Yuchen
2026-01-28 15:25     ` Tian Yuchen
2026-01-28 16:07 ` [PATCH v2] " Tian Yuchen
2026-01-30  6:41   ` Johannes Sixt
2026-01-30  9:55     ` Johannes Sixt [this message]
2026-01-30 16:27     ` Junio C Hamano
     [not found]       ` <b6f12614-ecc1-4d37-ac4c-070925054f28@gmail.com>
2026-01-30 16:47         ` Johannes Sixt
2026-01-30 14:31   ` Phillip Wood
2026-01-30 15:40     ` Tian Yuchen
2026-01-30 16:29   ` [PATCH v3] " Tian Yuchen
2026-01-30 17:01     ` [PATCH v4] " Tian Yuchen
2026-01-30 17:10     ` [PATCH v3] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=edc47d68-7e34-49af-b719-cef3076f6eeb@kdbg.org \
    --to=j6t@kdbg$(echo .)org \
    --cc=a3205153416@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox