Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v3 3/4] commit.c: replace some literal strings with constants

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:35

Jay Soffian [off-list ref] writes:
A typo in any of these would be bad, so let's use
constants for them

Signed-off-by: Jay Soffian <redacted>
---
I converted these per
http://article.gmane.org/gmane.comp.version-control.git/167015

Maybe this should be the last patch in the series; it's questionable to
me whether it's even worth doing.
Yeah, it's horrible ;-)
+static const char commit_editmsg[] = "COMMIT_EDITMSG";
+static const char cherry_pick_head[] = "CHERRY_PICK_HEAD";
+static const char merge_head[] = "MERGE_HEAD";
+static const char merge_msg[] = "MERGE_MSG";
+static const char merge_mode[] = "MERGE_MODE";
+static const char squash_msg[] = "SQUASH_MSG";
If they were like

	static const char COMMIT_EDITMSG[] = "...";

then that would give us typo-safety while keeping the similarity from
original code.  Uppercase variable names are a bit weird, though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help