Re: [RFC PATCH 3/3] setup: communicate why a directory is not a valid git directory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 24, 2026, 22:16 UTC
- Message-ID
- <xmqq7bkaz45e.fsf@gitster.g>
- In-Reply-To
- <20260924120502.2642141-4-kaartic.sivaraam@gmail.com>
Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:
Show 6 quoted lines
> + strbuf_addf(&die_msg, _("not a git repository: '%s'"), gitdirenv);
> + strbuf_addch(&die_msg, '\n');
> + strbuf_addf(&die_msg, _("reason: %s"), invalid_gitdir_reason.buf);
> + die("%s", die_msg.buf);
> +
> + strbuf_release(&die_msg);You just called die(); nobody will execute this strbuf_release() for you, and because die() is marked with NORETURN, smart enough compilers would scold you for introducing dead code.
Why are you lego-assembling localized message yourself, instead of doing something like ...
die(_("not a git repository: '%s'\nreason: %s"),
gitdirenv, invalid_gitdir_reason.buf);... which is what is usually done?