Subject: Re: [PATCH] builtin/gc: fix crash when running `git maintenance start`

From: Junio C Hamano <[email-masked]>
Date: Tue, 08 Oct 2024 11:33:40 -0700

Patrick Steinhardt <[email-masked]> writes:

> So why didn't we catch this trivial regression? The reason is that our
> tests always set up the "GIT_TEST_MAINT_SCHEDULER" environment variable
> via "t/test-lib.sh", which allows us to override the scheduler command
> with a custom one so that we don't accidentally modify the developer's
> system. But the faulty code where we don't set the `out` parameter will
> only get hit in case that environment variable is _not_ set, which is
> never the case when executing our tests.
>
> Fix the regression by again unconditionally allocating the value in the
> `out` parameter, if provided. Add a test that unsets the environment
> variable to catch future regressions in this area.
>
> Reported-by: Shubham Kanodia <[email-masked]>
> Signed-off-by: Patrick Steinhardt <[email-masked]>
> ---

Thanks for quickly reporting and addressing this one, both of you.

Will queue.