index-pack: work around thread-unsafe pread()
[gitweb.git] / t / t1507-rev-parse-upstream.sh
index 2a19e797eb7cffba28deb4e99b3708c5b26602ae..178694ee63937a9ec1f8d182d54441c2d20bd4a3 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}
 '
@@ -210,4 +231,20 @@ test_expect_success 'log -g other@{u}@{now}' '
        test_cmp expect actual
 '
 
+test_expect_success '@{reflog}-parsing does not look beyond colon' '
+       echo content >@{yesterday} &&
+       git add @{yesterday} &&
+       git commit -m "funny reflog file" &&
+       git hash-object @{yesterday} >expect &&
+       git rev-parse HEAD:@{yesterday} >actual
+'
+
+test_expect_success '@{upstream}-parsing does not look beyond colon' '
+       echo content >@{upstream} &&
+       git add @{upstream} &&
+       git commit -m "funny upstream file" &&
+       git hash-object @{upstream} >expect &&
+       git rev-parse HEAD:@{upstream} >actual
+'
+
 test_done