Symbolic refs work in the general case, but making @ a symbolic-ref
doesn't work due to a parsing bug in interpret_branch_name().  Update
the function to parse "@{", not '@' (since '@' is a valid symbolic
ref).

This makes a failing test in t1508 (at-combinations) pass.  In other
words, you can now do:

    $ git symbolic-ref @ HEAD

And expect the following to work:

    $ git rev-parse @@{u}

Signed-off-by: Ramkumar Ramachandra <artag...@gmail.com>
---
 sha1_name.c                | 2 +-
 t/t1508-at-combinations.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index 3820f28..850e6d7 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -1019,7 +1019,7 @@ int interpret_branch_name(const char *name, struct strbuf 
*buf)
                return ret - used + len;
        }
 
-       cp = strchr(name, '@');
+       cp = strstr(name, "@{");
        if (!cp)
                return -1;
        tmp_len = upstream_mark(cp, namelen - (cp - name));
diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 424caf5..6a69f9e 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -70,7 +70,7 @@ check "H@{u}" refs/heads/upstream-branch
 git symbolic-ref @ HEAD
 check "@@{1}" commit new-one
 check "@@{now}" commit new-two
-check "@@{u}" ref refs/heads/upstream-branch failure
+check "@@{u}" refs/heads/upstream-branch
 
 # Document differences between @{N} and HEAD@{N}.  The former resolves
 # HEAD to a branch and looks up the logs for that branch, while the
-- 
1.8.3.rc0.40.g09a0447

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to