Merge branch 'sb/submodule-module-list-pathspec-fix'
[alt-git.git] / t / t1514-rev-parse-push.sh
blob7214f5b33fa41fbb685e572ca24a0cb11337d251
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}
30 test_expect_success '@{push} with default=simple' '
31 test_config push.default simple &&
32 resolve master@{push} refs/remotes/origin/master
35 test_expect_success 'triangular @{push} fails with default=simple' '
36 test_config push.default simple &&
37 test_must_fail git rev-parse topic@{push}
40 test_expect_success '@{push} with default=current' '
41 test_config push.default current &&
42 resolve topic@{push} refs/remotes/origin/topic
45 test_expect_success '@{push} with default=matching' '
46 test_config push.default matching &&
47 resolve topic@{push} refs/remotes/origin/topic
50 test_expect_success '@{push} with pushremote defined' '
51 test_config push.default current &&
52 test_config branch.topic.pushremote other &&
53 resolve topic@{push} refs/remotes/other/topic
56 test_expect_success '@{push} with push refspecs' '
57 test_config push.default nothing &&
58 test_config remote.origin.push refs/heads/*:refs/heads/magic/* &&
59 git push &&
60 resolve topic@{push} refs/remotes/origin/magic/topic
63 test_done