On Tue, Sep 3, 2013 at 1:50 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Felipe Contreras <felipe.contreras@xxxxxxxxx> writes: > >> diff --git a/sha1_name.c b/sha1_name.c >> index 93197b9..b8ece6e 100644 >> --- a/sha1_name.c >> +++ b/sha1_name.c >> @@ -1004,6 +1004,26 @@ int get_sha1_mb(const char *name, unsigned char *sha1) >> return st; >> } >> >> +/* parse @something syntax, when 'something' is not {.*} */ >> +static int interpret_empty_at(const char *name, int namelen, int len, struct strbuf *buf) >> +{ >> + const char *next; >> + >> + if (len || name[1] == '{') >> + return -1; >> + >> + /* make sure it's a single @, or @@{.*}, not @foo */ >> + next = strchr(name + len + 1, '@'); >> + if (!next) >> + next = name + namelen; >> + if (next != name + 1) >> + return -1; >> + >> + strbuf_reset(buf); >> + strbuf_add(buf, "HEAD", 4); >> + return 1; >> +} > > Hmph, is the above sufficient? I added a case that mimics Stefano's > original regression report (which is handled) and another that uses > doubled "@" for the same purpose of introducing a "funny" hierarchy, > and it appears that "checkout -b" chokes on it. This fixes it: --- a/sha1_name.c +++ b/sha1_name.c @@ -1014,6 +1014,8 @@ static int interpret_empty_at(const char *name, int namelen, int len, struct str /* make sure it's a single @, or @@{.*}, not @foo */ next = strchr(name + len + 1, '@'); + if (next && next[1] != '{') + return -1; if (!next) next = name + namelen; if (next != name + 1) -- Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html