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/t1511-rev-parse-caret.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 / t1511-rev-parse-caret.sh` 134 lines ยท 3250 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='tests for ref^{stuff}' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 test_expect_success 'setup' ' 11 echo blob >a-blob && 12 git tag -a -m blob blob-tag $(git hash-object -w a-blob) && 13 mkdir a-tree && 14 echo moreblobs >a-tree/another-blob && 15 git add . && 16 TREE_SHA1=$(git write-tree) && 17 git tag -a -m tree tree-tag "$TREE_SHA1" && 18 git commit -m Initial && 19 git tag -a -m commit commit-tag && 20 git branch ref && 21 git checkout main && 22 echo modified >>a-blob && 23 git add -u && 24 git commit -m Modified && 25 git branch modref && 26 echo changed! >>a-blob && 27 git add -u && 28 git commit -m !Exp && 29 git branch expref && 30 echo changed >>a-blob && 31 git add -u && 32 git commit -m Changed && 33 echo changed-again >>a-blob && 34 git add -u && 35 git commit -m Changed-again 36 ' 37 38 test_expect_success 'ref^{non-existent}' ' 39 test_must_fail git rev-parse ref^{non-existent} 40 ' 41 42 test_expect_success 'ref^{}' ' 43 git rev-parse ref >expected && 44 git rev-parse ref^{} >actual && 45 test_cmp expected actual && 46 git rev-parse commit-tag^{} >actual && 47 test_cmp expected actual 48 ' 49 50 test_expect_success 'ref^{commit}' ' 51 git rev-parse ref >expected && 52 git rev-parse ref^{commit} >actual && 53 test_cmp expected actual && 54 git rev-parse commit-tag^{commit} >actual && 55 test_cmp expected actual && 56 test_must_fail git rev-parse tree-tag^{commit} && 57 test_must_fail git rev-parse blob-tag^{commit} 58 ' 59 60 test_expect_success 'ref^{tree}' ' 61 echo $TREE_SHA1 >expected && 62 git rev-parse ref^{tree} >actual && 63 test_cmp expected actual && 64 git rev-parse commit-tag^{tree} >actual && 65 test_cmp expected actual && 66 git rev-parse tree-tag^{tree} >actual && 67 test_cmp expected actual && 68 test_must_fail git rev-parse blob-tag^{tree} 69 ' 70 71 test_expect_success 'ref^{tag}' ' 72 test_must_fail git rev-parse HEAD^{tag} && 73 git rev-parse commit-tag >expected && 74 git rev-parse commit-tag^{tag} >actual && 75 test_cmp expected actual 76 ' 77 78 test_expect_success 'ref^{/.}' ' 79 git rev-parse main >expected && 80 git rev-parse main^{/.} >actual && 81 test_cmp expected actual 82 ' 83 84 test_expect_success 'ref^{/non-existent}' ' 85 test_must_fail git rev-parse main^{/non-existent} 86 ' 87 88 test_expect_success 'ref^{/Initial}' ' 89 git rev-parse ref >expected && 90 git rev-parse main^{/Initial} >actual && 91 test_cmp expected actual 92 ' 93 94 test_expect_success 'ref^{/!Exp}' ' 95 test_must_fail git rev-parse main^{/!Exp} 96 ' 97 98 test_expect_success 'ref^{/!}' ' 99 test_must_fail git rev-parse main^{/!} 100 ' 101 102 test_expect_success 'ref^{/!!Exp}' ' 103 git rev-parse expref >expected && 104 git rev-parse main^{/!!Exp} >actual && 105 test_cmp expected actual 106 ' 107 108 test_expect_success 'ref^{/!-}' ' 109 test_must_fail git rev-parse main^{/!-} 110 ' 111 112 test_expect_success 'ref^{/!-.}' ' 113 test_must_fail git rev-parse main^{/!-.} 114 ' 115 116 test_expect_success 'ref^{/!-non-existent}' ' 117 git rev-parse main >expected && 118 git rev-parse main^{/!-non-existent} >actual && 119 test_cmp expected actual 120 ' 121 122 test_expect_success 'ref^{/!-Changed}' ' 123 git rev-parse expref >expected && 124 git rev-parse main^{/!-Changed} >actual && 125 test_cmp expected actual 126 ' 127 128 test_expect_success 'ref^{/!-!Exp}' ' 129 git rev-parse modref >expected && 130 git rev-parse expref^{/!-!Exp} >actual && 131 test_cmp expected actual 132 ' 133 134 test_done