Re: [PATCH v3 3/4] commit.c: replace some literal strings with constants
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 17, 2011, 05:49 UTC
- Message-ID
- <7vlj1fdxcl.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1297916325-89688-4-git-send-email-jaysoffian@gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
Show 10 quoted lines
> A typo in any of these would be bad, so let's use > constants for them > > Signed-off-by: Jay Soffian <jaysoffian@gmail.com> > --- > 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 ;-)
Show 6 quoted lines
> +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.