Thread (18 messages) 18 messages, 3 authors, 21h ago

Re: [RFC PATCH 3/3] setup: communicate why a directory is not a valid git directory

From: Junio C Hamano <hidden>
Date: 2026-09-24 22:16:32

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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help