grep: avoid leak of chartables in PCRE2
[git.git] / t / t1514-rev-parse-push.sh
blob788cc91e452ce02af1c068b8c7b0bb1aa88ae395
1 #!/bin/sh
3 test_description='test <branch>@{push} syntax'
4 . ./test-lib.sh
6 resolve () {
7 echo "$2" >expect &&
8 git rev-parse --symbolic-full-name "$1" >actual &&
9 test_cmp expect actual
12 test_expect_success 'setup' '
13 git init --bare parent.git &&
14 git init --bare other.git &&
15 git remote add origin parent.git &&
16 git remote add other other.git &&
17 test_commit base &&
18 git push origin HEAD &&
19 git branch --set-upstream-to=origin/master master &&
20 git branch --track topic origin/master &&
21 git push origin topic &&
22 git push other topic
25 test_expect_success '@{push} with default=nothing' '
26 test_config push.default nothing &&
27 test_must_fail git rev-parse master@{push} &&
28 test_must_fail git rev-parse master@{PUSH} &&
29 test_must_fail git rev-parse master@{PuSH}
32 test_expect_success '@{push} with default=simple' '
33 test_config push.default simple &&
34 resolve master@{push} refs/remotes/origin/master &&
35 resolve master@{PUSH} refs/remotes/origin/master &&
36 resolve master@{pUSh} refs/remotes/origin/master
39 test_expect_success 'triangular @{push} fails with default=simple' '
40 test_config push.default simple &&
41 test_must_fail git rev-parse topic@{push}
44 test_expect_success '@{push} with default=current' '
45 test_config push.default current &&
46 resolve topic@{push} refs/remotes/origin/topic
49 test_expect_success '@{push} with default=matching' '
50 test_config push.default matching &&
51 resolve topic@{push} refs/remotes/origin/topic
54 test_expect_success '@{push} with pushremote defined' '
55 test_config push.default current &&
56 test_config branch.topic.pushremote other &&
57 resolve topic@{push} refs/remotes/other/topic
60 test_expect_success '@{push} with push refspecs' '
61 test_config push.default nothing &&
62 test_config remote.origin.push refs/heads/*:refs/heads/magic/* &&
63 git push &&
64 resolve topic@{push} refs/remotes/origin/magic/topic
67 test_expect_success 'resolving @{push} fails with a detached HEAD' '
68 git checkout HEAD^0 &&
69 test_when_finished "git checkout -" &&
70 test_must_fail git rev-parse @{push}
73 test_done