Kaartic Sivaraam [off-list ref] writes:
+ 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?