From: Clemens Buchacher <drizzd@aon.at>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Thomas Rast <trast@student.ethz.ch>
Subject: [PATCH] disallow branch names that start with a hyphen
Date: Sun, 22 Aug 2010 16:08:02 +0200 [thread overview]
Message-ID: <20100822140801.GA6574@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]
Branch names such as "-", "--" or even "---" do
not work with git checkout. Anything that starts
with a hyphen is also potentially ambiguous with a
command option.
In order to avoid mistakes, do not allow such
branch names.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
refs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/refs.c b/refs.c
index b540067..6884dff 100644
--- a/refs.c
+++ b/refs.c
@@ -742,7 +742,7 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
* Make sure "ref" is something reasonable to have under ".git/refs/";
* We do not like it if:
*
- * - any path component of it begins with ".", or
+ * - any path component of it begins with "." or "-", or
* - it has double dots "..", or
* - it has ASCII control character, "~", "^", ":" or SP, anywhere, or
* - it ends with a "/".
@@ -778,7 +778,7 @@ int check_ref_format(const char *ref)
return CHECK_REF_FORMAT_ERROR;
/* we are at the beginning of the path component */
- if (ch == '.')
+ if (ch == '.' || ch == '-')
return CHECK_REF_FORMAT_ERROR;
bad_type = bad_ref_char(ch);
if (bad_type) {
--
1.7.2.1.1.g202c
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next reply other threads:[~2010-08-22 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-22 14:08 Clemens Buchacher [this message]
2010-08-22 21:20 ` [PATCH] disallow branch names that start with a hyphen Junio C Hamano
2010-08-23 4:37 ` Clemens Buchacher
2010-09-14 20:09 ` Junio C Hamano
2010-09-14 20:38 ` Jakub Narebski
2010-09-15 7:34 ` Clemens Buchacher
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100822140801.GA6574@localhost \
--to=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).