From: "H. Peter Anvin" <hpa@zytor.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, junkio@cox.net
Subject: Re: [PATCH] We do not like "HEAD" as a new branch name
Date: Thu, 15 Dec 2005 08:27:14 -0800 [thread overview]
Message-ID: <43A19962.2000202@zytor.com> (raw)
In-Reply-To: <Pine.LNX.4.63.0512151244230.22400@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
> This makes git-check-ref-format fail for "HEAD". Since the check is only
> executed when creating refs, the existing symbolic ref is safe.
> diff --git a/refs.c b/refs.c
> index bda45f7..293bfe7 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -332,6 +332,11 @@ int check_ref_format(const char *ref)
> if (ch == '.' || bad_ref_char(ch))
> return -1;
>
> + /* do not allow "HEAD" as ref name */
> + if (ch == 'H' && (!strcmp(cp, "EAD") ||
> + !strncmp(cp, "EAD/", 4)))
> + return -1;
> +
> /* scan the rest of the path component */
> while ((ch = *cp++) != 0) {
If you're have to open-code it, you might want to just do it all the way:
if (ch == 'H' && cp[0] == 'E' && cp[1] == 'A' && cp[2] == 'D' &&
(cp[3] == '\0' || cp[3] == '/'))
-hpa
next prev parent reply other threads:[~2005-12-15 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-15 11:46 [PATCH] We do not like "HEAD" as a new branch name Johannes Schindelin
2005-12-15 16:27 ` H. Peter Anvin [this message]
2005-12-15 16:40 ` Johannes Schindelin
2005-12-15 17:00 ` Alex Riesen
2005-12-15 19:34 ` Junio C Hamano
2005-12-15 22:41 ` Johannes Schindelin
2005-12-15 23:38 ` Junio C Hamano
2005-12-16 1:40 ` Johannes Schindelin
2005-12-16 6:34 ` Junio C Hamano
2005-12-16 11:32 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43A19962.2000202@zytor.com \
--to=hpa@zytor.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).