From: Adrian Ratiu Date: Wed, 14 Jan 2026 08:59:42 GMT Subject: Re: [PATCH v2] hook: allow hooks to disable stdout_to_stderr Message-ID: <875x94zi0x.fsf@collabora.com> In-Reply-To: <878qe0zimo.fsf@gentoo.mail-host-address-is-not-set> On Wed, 14 Jan 2026, Adrian Ratiu wrote: > On Tue, 13 Jan 2026, Jeff King wrote: >> On Wed, Jan 14, 2026 at 01:45:28AM +0200, Adrian Ratiu wrote: >> >>> Changes in v2: >>> * Extended hook test coverage to detect future regressions (Junio, Patrick) >>> * Reworded commit message and added explanatory comment (Junio, Patrick) >>> * Set ungroup = 1 because grouping overrides stdout_to_stderr (Adrian) >> >> I have not really been following this topic, but I did read (and >> reproduce) Kristoffer's earlier report about reading stdin. The fix here >> was not quite what I expected. >> >> In particular... >> >>> @@ -93,6 +98,7 @@ struct run_hooks_opt >>> #define RUN_HOOKS_OPT_INIT { \ >>> .env = STRVEC_INIT, \ >>> .args = STRVEC_INIT, \ >>> + .stdout_to_stderr = 1, \ >>> } >> >> ...I expected to see: >> >> .ungroup = 1, \ > > Good catch. I actually missed this in v2. > > I will drop ungroup from this patch in v3 and add another patch fixing > Kristoffer's issue (rationale below). > >> >> here. The stdin issue goes back to 857f047e40 (hook: allow overriding >> the ungroup option, 2025-12-26), where the "ungroup" field was added, >> and various code paths set it to "1" to match the previous behavior. But >> any paths that were missed, including run_pre_push_hook(), would see a >> change of behavior (and in this case, a bug). >> >> My reading of 857f047e40 is that it meant to give callers the _option_ >> to switch the ungroup behavior, but not actually change anything. So >> wouldn't we want to leave the default as it was by initializing it to >> "1"? > > That is correct: my mistake in v2 was assuming Kristoffer and Chris > reported the same bug, when in fact there are 2 separate bugs requiring > separate fixes, so I will create 2 separate commits in v3 for each. Minor correction: I think we need 3 commits for 3 separate bugs we uncovered (ungroup should have its own commit). :) Please wait for v3, I will code, test and send it ASAP.