interpret_branch_name: find all possible @-marks
[git/git.git] / t / t1507-rev-parse-upstream.sh
index cace1ca..178694e 100755 (executable)
@@ -17,6 +17,9 @@ test_expect_success 'setup' '
         test_commit 4 &&
         git branch --track my-side origin/side &&
         git branch --track local-master master &&
+        git branch --track fun@ny origin/side &&
+        git branch --track @funny origin/side &&
+        git branch --track funny@ origin/side &&
         git remote add -t master master-only .. &&
         git fetch master-only &&
         git branch bad-upstream &&
@@ -54,6 +57,24 @@ test_expect_success 'my-side@{upstream} resolves to correct full name' '
        test refs/remotes/origin/side = "$(full_name my-side@{u})"
 '
 
+test_expect_success 'upstream of branch with @ in middle' '
+       full_name fun@ny@{u} >actual &&
+       echo refs/remotes/origin/side >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'upstream of branch with @ at start' '
+       full_name @funny@{u} >actual &&
+       echo refs/remotes/origin/side >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'upstream of branch with @ at end' '
+       full_name funny@@{u} >actual &&
+       echo refs/remotes/origin/side >expect &&
+       test_cmp expect actual
+'
+
 test_expect_success 'refs/heads/my-side@{upstream} does not resolve to my-side{upstream}' '
        test_must_fail full_name refs/heads/my-side@{upstream}
 '