git-bundle.txt: add missing words and punctuation
[git/debian.git] / t / t1514-rev-parse-push.sh
blobd868a0811056c83810bdd468d85e6f3a90622da7
1 #!/bin/sh
3 test_description='test <branch>@{push} syntax'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
9 resolve () {
10 echo "$2" >expect &&
11 git rev-parse --symbolic-full-name "$1" >actual &&
12 test_cmp expect actual
15 test_expect_success 'setup' '
16 git init --bare parent.git &&
17 git init --bare other.git &&
18 git remote add origin parent.git &&
19 git remote add other other.git &&
20 test_commit base &&
21 git push origin HEAD &&
22 git branch --set-upstream-to=origin/main main &&
23 git branch --track topic origin/main &&
24 git push origin topic &&
25 git push other topic
28 test_expect_success '@{push} with default=nothing' '
29 test_config push.default nothing &&
30 test_must_fail git rev-parse main@{push} &&
31 test_must_fail git rev-parse main@{PUSH} &&
32 test_must_fail git rev-parse main@{PuSH}
35 test_expect_success '@{push} with default=simple' '
36 test_config push.default simple &&
37 resolve main@{push} refs/remotes/origin/main &&
38 resolve main@{PUSH} refs/remotes/origin/main &&
39 resolve main@{pUSh} refs/remotes/origin/main
42 test_expect_success 'triangular @{push} fails with default=simple' '
43 test_config push.default simple &&
44 test_must_fail git rev-parse topic@{push}
47 test_expect_success '@{push} with default=current' '
48 test_config push.default current &&
49 resolve topic@{push} refs/remotes/origin/topic
52 test_expect_success '@{push} with default=matching' '
53 test_config push.default matching &&
54 resolve topic@{push} refs/remotes/origin/topic
57 test_expect_success '@{push} with pushremote defined' '
58 test_config push.default current &&
59 test_config branch.topic.pushremote other &&
60 resolve topic@{push} refs/remotes/other/topic
63 test_expect_success '@{push} with push refspecs' '
64 test_config push.default nothing &&
65 test_config remote.origin.push refs/heads/*:refs/heads/magic/* &&
66 git push &&
67 resolve topic@{push} refs/remotes/origin/magic/topic
70 test_expect_success 'resolving @{push} fails with a detached HEAD' '
71 git checkout HEAD^0 &&
72 test_when_finished "git checkout -" &&
73 test_must_fail git rev-parse @{push}
76 test_done