apply: do not read from beyond a symbolic link
[gitweb.git] / t / t1508-at-combinations.sh
index e5aea3b89602fdaf5ed3a9a230a604dd3f48cda0..078e1195dfa1625796fdbbf1b054ebf8a1ba2621 100755 (executable)
@@ -9,8 +9,11 @@ check() {
                if test '$2' = 'commit'
                then
                        git log -1 --format=%s '$1' >actual
-               else
+               elif test '$2' = 'ref'
+               then
                        git rev-parse --symbolic-full-name '$1' >actual
+               else
+                       git cat-file -p '$1' >actual
                fi &&
                test_cmp expect actual
        "
@@ -32,6 +35,9 @@ test_expect_success 'setup' '
        git checkout -b upstream-branch &&
        test_commit upstream-one &&
        test_commit upstream-two &&
+       git checkout -b @/at-test &&
+       git checkout -b @@/at-test &&
+       git checkout -b @at-test &&
        git checkout -b old-branch &&
        test_commit old-one &&
        test_commit old-two &&
@@ -55,6 +61,11 @@ check "HEAD@{u}" ref refs/heads/upstream-branch
 check "@{u}@{1}" commit upstream-one
 check "@{-1}@{u}" ref refs/heads/master
 check "@{-1}@{u}@{1}" commit master-one
+check "@" commit new-two
+check "@@{u}" ref refs/heads/upstream-branch
+check "@@/at-test" ref refs/heads/@@/at-test
+check "@/at-test" ref refs/heads/@/at-test
+check "@at-test" ref refs/heads/@at-test
 nonsense "@{u}@{-1}"
 nonsense "@{0}@{0}"
 nonsense "@{1}@{u}"
@@ -74,4 +85,14 @@ check HEAD ref refs/heads/old-branch
 check "HEAD@{1}" commit new-two
 check "@{1}" commit old-one
 
+test_expect_success 'create path with @' '
+       echo content >normal &&
+       echo content >fun@ny &&
+       git add normal fun@ny &&
+       git commit -m "funny path"
+'
+
+check "@:normal" blob content
+check "@:fun@ny" blob content
+
 test_done