Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1514-rev-parse-push.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1514-rev-parse-push.sh` 83 lines ยท 2347 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test @{push} syntax' 4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh 8 9 resolve () { 10 echo "$2" >expect && 11 git rev-parse --symbolic-full-name "$1" >actual && 12 test_cmp expect actual 13 } 14 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 26 ' 27 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} 33 ' 34 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 40 ' 41 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} 45 ' 46 47 test_expect_success '@{push} with default=current' ' 48 test_config push.default current && 49 resolve topic@{push} refs/remotes/origin/topic 50 ' 51 52 test_expect_success '@{push} with default=matching' ' 53 test_config push.default matching && 54 resolve topic@{push} refs/remotes/origin/topic 55 ' 56 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 61 ' 62 63 test_expect_success '@{p} is short for @{push}' ' 64 test_config push.default current && 65 test_config branch.topic.pushremote other && 66 resolve topic@{p} refs/remotes/other/topic && 67 resolve topic@{P} refs/remotes/other/topic 68 ' 69 70 test_expect_success '@{push} with push refspecs' ' 71 test_config push.default nothing && 72 test_config remote.origin.push refs/heads/*:refs/heads/magic/* && 73 git push && 74 resolve topic@{push} refs/remotes/origin/magic/topic 75 ' 76 77 test_expect_success 'resolving @{push} fails with a detached HEAD' ' 78 git checkout HEAD^0 && 79 test_when_finished "git checkout -" && 80 test_must_fail git rev-parse @{push} 81 ' 82 83 test_done