3 test_description
='test various @{X} syntax combinations together'
7 test_expect_
${4:-success} "$1 = $3" "
9 if test '$2' = 'commit'
11 git log -1 --format=%s '$1' >actual
13 git rev-parse --symbolic-full-name '$1' >actual
15 test_cmp expect actual
20 test_expect_
${2:-success} "$1 is nonsensical" "
21 test_must_fail git log -1 '$1'
29 test_expect_success
'setup' '
30 test_commit master-one &&
31 test_commit master-two &&
32 git checkout -b upstream-branch &&
33 test_commit upstream-one &&
34 test_commit upstream-two &&
35 git checkout -b old-branch &&
36 test_commit old-one &&
37 test_commit old-two &&
38 git checkout -b new-branch &&
39 test_commit new-one &&
40 test_commit new-two &&
41 git branch -u master old-branch &&
42 git branch -u upstream-branch new-branch
45 check HEAD ref refs
/heads
/new-branch
46 check
"@{1}" commit new-one
47 check
"@{-1}" ref refs
/heads
/old-branch
48 check
"@{-1}@{1}" commit old-one
49 check
"@{u}" ref refs
/heads
/upstream-branch
50 check
"@{u}@{1}" commit upstream-one
51 check
"@{-1}@{u}" ref refs
/heads
/master
52 check
"@{-1}@{u}@{1}" commit master-one