Git fork

t6[0-3]*: adjust the references to the default branch name "main"

Carefully excluding t6300, which sees independent development elsewhere
at the time of writing, we use `main` as the default branch name in
t6[0-3]*. This trick was performed via

$ (cd t &&
sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
-e 's/Master/Main/g' -- t6[0-3]*.sh &&
git checkout HEAD -- t6300\*)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Johannes Schindelin and committed by
Junio C Hamano
1550bb6e 95cf2c01

+194 -194
+2 -2
t/t6000-rev-list-misc.sh
··· 2 3 test_description='miscellaneous rev-list tests' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 88 ' 89 90 test_expect_success 'symleft flag bit is propagated down from tag' ' 91 - git log --format="%m %s" --left-right v1.0...master >actual && 92 cat >expect <<-\EOF && 93 < another 94 < that
··· 2 3 test_description='miscellaneous rev-list tests' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 88 ' 89 90 test_expect_success 'symleft flag bit is propagated down from tag' ' 91 + git log --format="%m %s" --left-right v1.0...main >actual && 92 cat >expect <<-\EOF && 93 < another 94 < that
+2 -2
t/t6001-rev-list-graft.sh
··· 2 3 test_description='Revision traversal vs grafts and path limiter' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 23 git commit -a -m "Third in one history." && 24 A2=$(git rev-parse --verify HEAD) && 25 26 - rm -f .git/refs/heads/master .git/index && 27 28 echo >fileA fileA again && 29 echo >subdir/fileB fileB again &&
··· 2 3 test_description='Revision traversal vs grafts and path limiter' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 23 git commit -a -m "Third in one history." && 24 A2=$(git rev-parse --verify HEAD) && 25 26 + rm -f .git/refs/heads/main .git/index && 27 28 echo >fileA fileA again && 29 echo >subdir/fileB fileB again &&
+8 -8
t/t6004-rev-list-path-optim.sh
··· 4 5 d/z1 6 b0 b1 7 - o------------------------*----o master 8 / / 9 o---------o----o----o----o side 10 a0 c0 c1 a1 c2 ··· 13 14 ' 15 16 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 17 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 18 19 . ./test-lib.sh ··· 58 git add c && 59 test_tick && 60 git commit -m "Side makes yet another irrelevant commit" && 61 - git checkout master && 62 echo Another >b && 63 echo Munged >d/z && 64 git add b d/z && 65 test_tick && 66 - git commit -m "Master touches b" && 67 - git tag master_b0 && 68 git merge side && 69 echo Touched >b && 70 git add b && 71 test_tick && 72 - git commit -m "Master touches b again" 73 ' 74 75 test_expect_success 'path optimization 2' ' ··· 79 ' 80 81 test_expect_success 'pathspec with leading path' ' 82 - git rev-parse master^ master_b0 side_c0 initial >expected && 83 git rev-list HEAD -- d >actual && 84 test_cmp expected actual 85 ' 86 87 test_expect_success 'pathspec with glob (1)' ' 88 - git rev-parse master^ master_b0 side_c0 initial >expected && 89 git rev-list HEAD -- "d/*" >actual && 90 test_cmp expected actual 91 '
··· 4 5 d/z1 6 b0 b1 7 + o------------------------*----o main 8 / / 9 o---------o----o----o----o side 10 a0 c0 c1 a1 c2 ··· 13 14 ' 15 16 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 17 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 18 19 . ./test-lib.sh ··· 58 git add c && 59 test_tick && 60 git commit -m "Side makes yet another irrelevant commit" && 61 + git checkout main && 62 echo Another >b && 63 echo Munged >d/z && 64 git add b d/z && 65 test_tick && 66 + git commit -m "Main touches b" && 67 + git tag main_b0 && 68 git merge side && 69 echo Touched >b && 70 git add b && 71 test_tick && 72 + git commit -m "Main touches b again" 73 ' 74 75 test_expect_success 'path optimization 2' ' ··· 79 ' 80 81 test_expect_success 'pathspec with leading path' ' 82 + git rev-parse main^ main_b0 side_c0 initial >expected && 83 git rev-list HEAD -- d >actual && 84 test_cmp expected actual 85 ' 86 87 test_expect_success 'pathspec with glob (1)' ' 88 + git rev-parse main^ main_b0 side_c0 initial >expected && 89 git rev-list HEAD -- "d/*" >actual && 90 test_cmp expected actual 91 '
+8 -8
t/t6006-rev-list-format.sh
··· 5 6 test_description='git rev-list --pretty=format test' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 56 test_format () { 57 cat >expect.$1 58 test_expect_${3:-success} "format $1" " 59 - git rev-list --pretty=format:'$2' master >output.$1 && 60 test_cmp expect.$1 output.$1 61 " 62 } ··· 187 <RED>foo<GREEN>bar<BLUE>baz<RESET>xyzzy 188 EOF 189 format="%Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy" && 190 - git rev-list --color --format="$format" -1 master >actual.raw && 191 test_decode_color <actual.raw >actual && 192 test_cmp expect actual 193 ' 194 195 test_expect_success '%S is not a placeholder for rev-list yet' ' 196 - git rev-list --format="%S" -1 master | grep "%S" 197 ' 198 199 test_expect_success 'advanced colors' ' ··· 202 <BOLD;RED;BYELLOW>foo<RESET> 203 EOF 204 format="%C(red yellow bold)foo%C(reset)" && 205 - git rev-list --color --format="$format" -1 master >actual.raw && 206 test_decode_color <actual.raw >actual && 207 test_cmp expect actual 208 ' ··· 409 410 test_expect_success '%ad respects --date=' ' 411 echo 2005-04-07 >expect.ad-short && 412 - git log -1 --date=short --pretty=tformat:%ad >output.ad-short master && 413 test_cmp expect.ad-short output.ad-short 414 ' 415 ··· 497 ' 498 499 test_expect_success '%gd shortens ref name' ' 500 - echo "master@{0}" >expect.gd-short && 501 - git log -g -1 --format=%gd refs/heads/master >actual.gd-short && 502 test_cmp expect.gd-short actual.gd-short 503 ' 504
··· 5 6 test_description='git rev-list --pretty=format test' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 56 test_format () { 57 cat >expect.$1 58 test_expect_${3:-success} "format $1" " 59 + git rev-list --pretty=format:'$2' main >output.$1 && 60 test_cmp expect.$1 output.$1 61 " 62 } ··· 187 <RED>foo<GREEN>bar<BLUE>baz<RESET>xyzzy 188 EOF 189 format="%Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy" && 190 + git rev-list --color --format="$format" -1 main >actual.raw && 191 test_decode_color <actual.raw >actual && 192 test_cmp expect actual 193 ' 194 195 test_expect_success '%S is not a placeholder for rev-list yet' ' 196 + git rev-list --format="%S" -1 main | grep "%S" 197 ' 198 199 test_expect_success 'advanced colors' ' ··· 202 <BOLD;RED;BYELLOW>foo<RESET> 203 EOF 204 format="%C(red yellow bold)foo%C(reset)" && 205 + git rev-list --color --format="$format" -1 main >actual.raw && 206 test_decode_color <actual.raw >actual && 207 test_cmp expect actual 208 ' ··· 409 410 test_expect_success '%ad respects --date=' ' 411 echo 2005-04-07 >expect.ad-short && 412 + git log -1 --date=short --pretty=tformat:%ad >output.ad-short main && 413 test_cmp expect.ad-short output.ad-short 414 ' 415 ··· 497 ' 498 499 test_expect_success '%gd shortens ref name' ' 500 + echo "main@{0}" >expect.gd-short && 501 + git log -g -1 --format=%gd refs/heads/main >actual.gd-short && 502 test_cmp expect.gd-short actual.gd-short 503 ' 504
+3 -3
t/t6007-rev-list-cherry-pick-file.sh
··· 2 3 test_description='test git rev-list --cherry-pick -- file' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 34 test_tick && 35 git commit -m "E" && 36 git tag E && 37 - git checkout master && 38 git checkout branch foo && 39 test_tick && 40 git commit -m "B" && ··· 236 test_tick && 237 git commit -m "independent, too" foo && 238 test -z "$(git rev-list --left-right --cherry-pick \ 239 - HEAD...master -- foo)" 240 ' 241 242 cat >expect <<EOF
··· 2 3 test_description='test git rev-list --cherry-pick -- file' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 34 test_tick && 35 git commit -m "E" && 36 git tag E && 37 + git checkout main && 38 git checkout branch foo && 39 test_tick && 40 git commit -m "B" && ··· 236 test_tick && 237 git commit -m "independent, too" foo && 238 test -z "$(git rev-list --left-right --cherry-pick \ 239 + HEAD...main -- foo)" 240 ' 241 242 cat >expect <<EOF
+2 -2
t/t6008-rev-list-submodule.sh
··· 5 6 test_description='git rev-list involving submodules that this repo has' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 39 ' 40 41 test_expect_success "Ilari's test" ' 42 - git rev-list --objects super master ^super^ 43 ' 44 45 test_done
··· 5 6 test_description='git rev-list involving submodules that this repo has' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 39 ' 40 41 test_expect_success "Ilari's test" ' 42 + git rev-list --objects super main ^super^ 43 ' 44 45 test_done
+4 -4
t/t6009-rev-list-parent.sh
··· 2 3 test_description='ancestor culling and limiting by parent number' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 48 test_commit seven && 49 git checkout -b yetanotherbranch four && 50 test_commit eight && 51 - git checkout master && 52 test_tick && 53 git merge --allow-unrelated-histories -m normalmerge newroot && 54 git tag normalmerge && ··· 59 test_tick && 60 git merge -m tetrapus sidebranch anotherbranch yetanotherbranch && 61 git tag tetrapus && 62 - git checkout master 63 ' 64 65 test_expect_success 'rev-list roots' ' ··· 126 roots="$roots root$i" || 127 return 128 done && 129 - git checkout master && 130 test_tick && 131 git merge -m dodecapus $roots && 132 git tag dodecapus &&
··· 2 3 test_description='ancestor culling and limiting by parent number' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 48 test_commit seven && 49 git checkout -b yetanotherbranch four && 50 test_commit eight && 51 + git checkout main && 52 test_tick && 53 git merge --allow-unrelated-histories -m normalmerge newroot && 54 git tag normalmerge && ··· 59 test_tick && 60 git merge -m tetrapus sidebranch anotherbranch yetanotherbranch && 61 git tag tetrapus && 62 + git checkout main 63 ' 64 65 test_expect_success 'rev-list roots' ' ··· 126 roots="$roots root$i" || 127 return 128 done && 129 + git checkout main && 130 test_tick && 131 git merge -m dodecapus $roots && 132 git tag dodecapus &&
+5 -5
t/t6012-rev-list-simplify.sh
··· 2 3 test_description='merge simplification' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 46 git add side && 47 test_tick && git commit -m "Side root" && 48 note J && 49 - git checkout master && 50 51 echo "Hello" >file && 52 echo "second" >lost && ··· 68 note D && 69 70 test_tick && 71 - test_must_fail git merge -m "merge" master && 72 >lost && git commit -a -m "merge" && 73 note E && 74 ··· 77 test_tick && git commit -m "Irrelevant change" && 78 note F && 79 80 - git checkout master && 81 echo "Yet another" >elif && 82 git add elif && 83 test_tick && git commit -m "Another irrelevant change" && ··· 90 test_tick && git commit -a -m "Final change" && 91 note I && 92 93 - git checkout master && 94 test_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated && 95 note K && 96
··· 2 3 test_description='merge simplification' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 46 git add side && 47 test_tick && git commit -m "Side root" && 48 note J && 49 + git checkout main && 50 51 echo "Hello" >file && 52 echo "second" >lost && ··· 68 note D && 69 70 test_tick && 71 + test_must_fail git merge -m "merge" main && 72 >lost && git commit -a -m "merge" && 73 note E && 74 ··· 77 test_tick && git commit -m "Irrelevant change" && 78 note F && 79 80 + git checkout main && 81 echo "Yet another" >elif && 82 git add elif && 83 test_tick && git commit -m "Another irrelevant change" && ··· 90 test_tick && git commit -a -m "Final change" && 91 note I && 92 93 + git checkout main && 94 test_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated && 95 note K && 96
+6 -6
t/t6013-rev-list-reverse-parents.sh
··· 2 3 test_description='--reverse combines with --parents' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 21 commit two && 22 git checkout -b side HEAD^ && 23 commit three && 24 - git checkout master && 25 git merge -s ours side && 26 commit five 27 ' 28 29 test_expect_success '--reverse --parents --full-history combines correctly' ' 30 - git rev-list --parents --full-history master -- foo | 31 perl -e "print reverse <>" > expected && 32 - git rev-list --reverse --parents --full-history master -- foo \ 33 > actual && 34 test_cmp expected actual 35 ' 36 37 test_expect_success '--boundary does too' ' 38 - git rev-list --boundary --parents --full-history master ^root -- foo | 39 perl -e "print reverse <>" > expected && 40 git rev-list --boundary --reverse --parents --full-history \ 41 - master ^root -- foo > actual && 42 test_cmp expected actual 43 ' 44
··· 2 3 test_description='--reverse combines with --parents' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 21 commit two && 22 git checkout -b side HEAD^ && 23 commit three && 24 + git checkout main && 25 git merge -s ours side && 26 commit five 27 ' 28 29 test_expect_success '--reverse --parents --full-history combines correctly' ' 30 + git rev-list --parents --full-history main -- foo | 31 perl -e "print reverse <>" > expected && 32 + git rev-list --reverse --parents --full-history main -- foo \ 33 > actual && 34 test_cmp expected actual 35 ' 36 37 test_expect_success '--boundary does too' ' 38 + git rev-list --boundary --parents --full-history main ^root -- foo | 39 perl -e "print reverse <>" > expected && 40 git rev-list --boundary --reverse --parents --full-history \ 41 + main ^root -- foo > actual && 42 test_cmp expected actual 43 ' 44
+2 -2
t/t6016-rev-list-graph-simplify-history.sh
··· 7 8 test_description='--graph and simplified history' 9 10 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 11 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 12 13 . ./test-lib.sh ··· 17 test_commit A1 foo.txt && 18 test_commit A2 bar.txt && 19 test_commit A3 bar.txt && 20 - git branch -m master A && 21 22 # 2 commits on branch B, started from A1 23 git checkout -b B A1 &&
··· 7 8 test_description='--graph and simplified history' 9 10 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 11 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 12 13 . ./test-lib.sh ··· 17 test_commit A1 foo.txt && 18 test_commit A2 bar.txt && 19 test_commit A3 bar.txt && 20 + git branch -m main A && 21 22 # 2 commits on branch B, started from A1 23 git checkout -b B A1 &&
+5 -5
t/t6017-rev-list-stdin.sh
··· 5 6 test_description='log family learns --stdin' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 43 done && 44 for i in $them 45 do 46 - git checkout -b side-$i master~$i && 47 echo updated $i >file-$i && 48 git add file-$i && 49 test_tick && ··· 52 ) 53 ' 54 55 - check master 56 check side-1 ^side-4 57 check side-1 ^side-7 -- 58 check side-1 ^side-7 -- file-1 ··· 69 file-2 70 EOF 71 cat >input <<-EOF && 72 - ^master^ 73 -- 74 file-2 75 EOF 76 - git log --pretty=tformat:%s --name-only --stdin master -- file-1 \ 77 <input >actual && 78 test_cmp expect actual 79 '
··· 5 6 test_description='log family learns --stdin' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 43 done && 44 for i in $them 45 do 46 + git checkout -b side-$i main~$i && 47 echo updated $i >file-$i && 48 git add file-$i && 49 test_tick && ··· 52 ) 53 ' 54 55 + check main 56 check side-1 ^side-4 57 check side-1 ^side-7 -- 58 check side-1 ^side-7 -- file-1 ··· 69 file-2 70 EOF 71 cat >input <<-EOF && 72 + ^main^ 73 -- 74 file-2 75 EOF 76 + git log --pretty=tformat:%s --name-only --stdin main -- file-1 \ 77 <input >actual && 78 test_cmp expect actual 79 '
+26 -26
t/t6018-rev-list-glob.sh
··· 2 3 test_description='rev-list/rev-parse --glob' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 23 24 test_expect_success 'setup' ' 25 26 - commit master && 27 - git checkout -b subspace/one master && 28 commit one && 29 - git checkout -b subspace/two master && 30 commit two && 31 - git checkout -b subspace-x master && 32 commit subspace-x && 33 - git checkout -b other/three master && 34 commit three && 35 - git checkout -b someref master && 36 commit some && 37 - git checkout master && 38 commit topic_2 && 39 - git tag foo/bar master && 40 commit topic_3 && 41 - git update-ref refs/remotes/foo/baz master && 42 commit topic_4 && 43 git update-ref refs/remotes/upstream/one subspace/one && 44 git update-ref refs/remotes/upstream/two subspace/two && ··· 86 87 test_expect_failure 'rev-parse is not confused by option-like glob' ' 88 89 - compare rev-parse "master" "--glob --symbolic master" 90 91 ' 92 ··· 114 115 ' 116 117 - test_expect_success 'rev-parse --glob=heads/someref/* master' ' 118 119 - compare rev-parse "master" "--glob=heads/someref/* master" 120 121 ' 122 123 test_expect_success 'rev-parse --glob=heads/*' ' 124 125 - compare rev-parse "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" 126 127 ' 128 ··· 139 ' 140 141 test_expect_success 'rev-parse --exclude with --branches' ' 142 - compare rev-parse "--exclude=*/* --branches" "master someref subspace-x" 143 ' 144 145 test_expect_success 'rev-parse --exclude with --all' ' ··· 224 225 test_expect_success 'rev-list not confused by option-like --glob arg' ' 226 227 - compare rev-list "master" "--glob -0 master" 228 229 ' 230 ··· 272 273 test_expect_success 'rev-list --branches' ' 274 275 - compare rev-list "master subspace-x someref other/three subspace/one subspace/two" "--branches" 276 277 ' 278 279 - test_expect_success 'rev-list --glob=heads/someref/* master' ' 280 281 - compare rev-list "master" "--glob=heads/someref/* master" 282 283 ' 284 ··· 290 291 test_expect_success 'rev-list --glob=heads/*' ' 292 293 - compare rev-list "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" 294 295 ' 296 ··· 313 ' 314 315 test_expect_success 'rev-list --exclude with --branches' ' 316 - compare rev-list "--exclude=*/* --branches" "master someref subspace-x" 317 ' 318 319 test_expect_success 'rev-list --exclude with --all' ' ··· 357 358 compare shortlog "subspace/one subspace/two" --branches=subspace && 359 compare shortlog \ 360 - "master subspace-x someref other/three subspace/one subspace/two" \ 361 --branches && 362 - compare shortlog master "--glob=heads/someref/* master" && 363 compare shortlog "subspace/one subspace/two other/three" \ 364 "--glob=heads/subspace/* --glob=heads/other/*" && 365 compare shortlog \ 366 - "master other/three someref subspace-x subspace/one subspace/two" \ 367 "--glob=heads/*" && 368 compare shortlog foo/bar --tags=foo && 369 compare shortlog "foo/bar qux/one qux/two qux/x" --tags && ··· 374 test_expect_failure 'shortlog accepts --glob as detached option' ' 375 376 compare shortlog \ 377 - "master other/three someref subspace-x subspace/one subspace/two" \ 378 "--glob heads/*" 379 380 ' 381 382 test_expect_failure 'shortlog --glob is not confused by option-like argument' ' 383 384 - compare shortlog master "--glob -e master" 385 386 ' 387
··· 2 3 test_description='rev-list/rev-parse --glob' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 23 24 test_expect_success 'setup' ' 25 26 + commit main && 27 + git checkout -b subspace/one main && 28 commit one && 29 + git checkout -b subspace/two main && 30 commit two && 31 + git checkout -b subspace-x main && 32 commit subspace-x && 33 + git checkout -b other/three main && 34 commit three && 35 + git checkout -b someref main && 36 commit some && 37 + git checkout main && 38 commit topic_2 && 39 + git tag foo/bar main && 40 commit topic_3 && 41 + git update-ref refs/remotes/foo/baz main && 42 commit topic_4 && 43 git update-ref refs/remotes/upstream/one subspace/one && 44 git update-ref refs/remotes/upstream/two subspace/two && ··· 86 87 test_expect_failure 'rev-parse is not confused by option-like glob' ' 88 89 + compare rev-parse "main" "--glob --symbolic main" 90 91 ' 92 ··· 114 115 ' 116 117 + test_expect_success 'rev-parse --glob=heads/someref/* main' ' 118 119 + compare rev-parse "main" "--glob=heads/someref/* main" 120 121 ' 122 123 test_expect_success 'rev-parse --glob=heads/*' ' 124 125 + compare rev-parse "main other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" 126 127 ' 128 ··· 139 ' 140 141 test_expect_success 'rev-parse --exclude with --branches' ' 142 + compare rev-parse "--exclude=*/* --branches" "main someref subspace-x" 143 ' 144 145 test_expect_success 'rev-parse --exclude with --all' ' ··· 224 225 test_expect_success 'rev-list not confused by option-like --glob arg' ' 226 227 + compare rev-list "main" "--glob -0 main" 228 229 ' 230 ··· 272 273 test_expect_success 'rev-list --branches' ' 274 275 + compare rev-list "main subspace-x someref other/three subspace/one subspace/two" "--branches" 276 277 ' 278 279 + test_expect_success 'rev-list --glob=heads/someref/* main' ' 280 281 + compare rev-list "main" "--glob=heads/someref/* main" 282 283 ' 284 ··· 290 291 test_expect_success 'rev-list --glob=heads/*' ' 292 293 + compare rev-list "main other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*" 294 295 ' 296 ··· 313 ' 314 315 test_expect_success 'rev-list --exclude with --branches' ' 316 + compare rev-list "--exclude=*/* --branches" "main someref subspace-x" 317 ' 318 319 test_expect_success 'rev-list --exclude with --all' ' ··· 357 358 compare shortlog "subspace/one subspace/two" --branches=subspace && 359 compare shortlog \ 360 + "main subspace-x someref other/three subspace/one subspace/two" \ 361 --branches && 362 + compare shortlog main "--glob=heads/someref/* main" && 363 compare shortlog "subspace/one subspace/two other/three" \ 364 "--glob=heads/subspace/* --glob=heads/other/*" && 365 compare shortlog \ 366 + "main other/three someref subspace-x subspace/one subspace/two" \ 367 "--glob=heads/*" && 368 compare shortlog foo/bar --tags=foo && 369 compare shortlog "foo/bar qux/one qux/two qux/x" --tags && ··· 374 test_expect_failure 'shortlog accepts --glob as detached option' ' 375 376 compare shortlog \ 377 + "main other/three someref subspace-x subspace/one subspace/two" \ 378 "--glob heads/*" 379 380 ' 381 382 test_expect_failure 'shortlog --glob is not confused by option-like argument' ' 383 384 + compare shortlog main "--glob -e main" 385 386 ' 387
+4 -4
t/t6019-rev-list-ancestry-path.sh
··· 21 # --ancestry-path G..M -- G.t == L 22 # --ancestry-path --simplify-merges G^..M -- G.t == G L 23 24 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 25 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 26 27 . ./test-lib.sh ··· 131 (cd criss-cross && 132 git init && 133 test_commit A && 134 - git checkout -b xb master && 135 test_commit B && 136 - git checkout -b xc master && 137 test_commit C && 138 git checkout -b xbc xb -- && 139 git merge xc && 140 git checkout -b xcb xc -- && 141 git merge xb && 142 - git checkout master) 143 ' 144 145 # no commits in bc descend from cb
··· 21 # --ancestry-path G..M -- G.t == L 22 # --ancestry-path --simplify-merges G^..M -- G.t == G L 23 24 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 25 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 26 27 . ./test-lib.sh ··· 131 (cd criss-cross && 132 git init && 133 test_commit A && 134 + git checkout -b xb main && 135 test_commit B && 136 + git checkout -b xc main && 137 test_commit C && 138 git checkout -b xbc xb -- && 139 git merge xc && 140 git checkout -b xcb xc -- && 141 git merge xb && 142 + git checkout main) 143 ' 144 145 # no commits in bc descend from cb
+6 -6
t/t6030-bisect-porcelain.sh
··· 6 7 exec </dev/null 8 9 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 92 grep bar ".git/BISECT_NAMES" 93 ' 94 95 - test_expect_success 'bisect reset: back in the master branch' ' 96 git bisect reset && 97 - echo "* master" > branch.expect && 98 git branch > branch.output && 99 cmp branch.expect branch.output 100 ' ··· 105 git bisect good $HASH1 && 106 git bisect bad $HASH3 && 107 git bisect reset && 108 - echo " master" > branch.expect && 109 echo "* other" >> branch.expect && 110 git branch > branch.output && 111 cmp branch.expect branch.output ··· 351 352 test_expect_success 'bisect starting with a detached HEAD' ' 353 git bisect reset && 354 - git checkout master^ && 355 HEAD=$(git rev-parse --verify HEAD) && 356 git bisect start && 357 test $HEAD = $(cat .git/BISECT_START) && ··· 719 test_expect_success 'bisect: demonstrate identification of damage boundary' " 720 git bisect reset && 721 git checkout broken && 722 - git bisect start broken master --no-checkout && 723 test_must_fail git bisect run \"\$SHELL_PATH\" -c ' 724 GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) && 725 git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
··· 6 7 exec </dev/null 8 9 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 10 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 11 12 . ./test-lib.sh ··· 92 grep bar ".git/BISECT_NAMES" 93 ' 94 95 + test_expect_success 'bisect reset: back in the main branch' ' 96 git bisect reset && 97 + echo "* main" > branch.expect && 98 git branch > branch.output && 99 cmp branch.expect branch.output 100 ' ··· 105 git bisect good $HASH1 && 106 git bisect bad $HASH3 && 107 git bisect reset && 108 + echo " main" > branch.expect && 109 echo "* other" >> branch.expect && 110 git branch > branch.output && 111 cmp branch.expect branch.output ··· 351 352 test_expect_success 'bisect starting with a detached HEAD' ' 353 git bisect reset && 354 + git checkout main^ && 355 HEAD=$(git rev-parse --verify HEAD) && 356 git bisect start && 357 test $HEAD = $(cat .git/BISECT_START) && ··· 719 test_expect_success 'bisect: demonstrate identification of damage boundary' " 720 git bisect reset && 721 git checkout broken && 722 + git bisect start broken main --no-checkout && 723 test_must_fail git bisect run \"\$SHELL_PATH\" -c ' 724 GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) && 725 git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
+28 -28
t/t6040-tracking-info.sh
··· 2 3 test_description='remote tracking stats' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 37 git branch -d brokenbase && 38 git checkout -b b6 origin 39 ) && 40 - git checkout -b follower --track master && 41 advance h 42 ' 43 ··· 61 ' 62 63 cat >expect <<\EOF 64 - b1 [origin/master: ahead 1, behind 1] d 65 - b2 [origin/master: ahead 1, behind 1] d 66 - b3 [origin/master: behind 1] b 67 - b4 [origin/master: ahead 2] f 68 b5 [brokenbase: gone] g 69 - b6 [origin/master] c 70 EOF 71 72 test_expect_success 'branch -vv' ' ··· 86 ' 87 88 test_expect_success 'checkout with local tracked branch' ' 89 - git checkout master && 90 git checkout follower >actual && 91 test_i18ngrep "is ahead of" actual 92 ' ··· 103 ( 104 cd test && git checkout b6 105 ) >actual && 106 - test_i18ngrep "Your branch is up to date with .origin/master" actual 107 ' 108 109 test_expect_success 'status (diverged from upstream)' ' ··· 133 # reports nothing to commit 134 test_must_fail git commit --dry-run 135 ) >actual && 136 - test_i18ngrep "Your branch is up to date with .origin/master" actual 137 ' 138 139 cat >expect <<\EOF 140 - ## b1...origin/master [ahead 1, behind 1] 141 EOF 142 143 test_expect_success 'status -s -b (diverged from upstream)' ' ··· 150 ' 151 152 cat >expect <<\EOF 153 - ## b1...origin/master [different] 154 EOF 155 156 test_expect_success 'status -s -b --no-ahead-behind (diverged from upstream)' ' ··· 163 ' 164 165 cat >expect <<\EOF 166 - ## b1...origin/master [different] 167 EOF 168 169 test_expect_success 'status.aheadbehind=false status -s -b (diverged from upstream)' ' ··· 177 178 cat >expect <<\EOF 179 On branch b1 180 - Your branch and 'origin/master' have diverged, 181 and have 1 and 1 different commits each, respectively. 182 EOF 183 ··· 201 202 cat >expect <<\EOF 203 On branch b1 204 - Your branch and 'origin/master' refer to different commits. 205 EOF 206 207 test_expect_success 'status --long --branch --no-ahead-behind' ' ··· 236 ' 237 238 cat >expect <<\EOF 239 - ## b6...origin/master 240 EOF 241 242 test_expect_success 'status -s -b (up-to-date with upstream)' ' ··· 249 ' 250 251 test_expect_success 'fail to track lightweight tags' ' 252 - git checkout master && 253 git tag light && 254 test_must_fail git branch --track lighttrack light >actual && 255 test_i18ngrep ! "set up to track" actual && ··· 257 ' 258 259 test_expect_success 'fail to track annotated tags' ' 260 - git checkout master && 261 git tag -m heavy heavy && 262 test_must_fail git branch --track heavytrack heavy >actual && 263 test_i18ngrep ! "set up to track" actual && ··· 265 ' 266 267 test_expect_success '--set-upstream-to does not change branch' ' 268 - git branch from-master master && 269 - git branch --set-upstream-to master from-master && 270 - git branch from-topic_2 master && 271 test_must_fail git config branch.from-topic_2.merge > actual && 272 git rev-list from-topic_2 && 273 git update-ref refs/heads/from-topic_2 from-topic_2^ && 274 git rev-parse from-topic_2 >expect2 && 275 - git branch --set-upstream-to master from-topic_2 && 276 - git config branch.from-master.merge > actual && 277 git rev-parse from-topic_2 >actual2 && 278 - grep -q "^refs/heads/master$" actual && 279 cmp expect2 actual2 280 ' 281 ··· 283 git checkout follower && 284 git checkout from-topic_2 && 285 git config branch.from-topic_2.merge > expect2 && 286 - git branch --set-upstream-to @{-1} from-master && 287 - git config branch.from-master.merge > actual && 288 git config branch.from-topic_2.merge > actual2 && 289 - git branch --set-upstream-to follower from-master && 290 - git config branch.from-master.merge > expect && 291 test_cmp expect2 actual2 && 292 test_cmp expect actual 293 '
··· 2 3 test_description='remote tracking stats' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 37 git branch -d brokenbase && 38 git checkout -b b6 origin 39 ) && 40 + git checkout -b follower --track main && 41 advance h 42 ' 43 ··· 61 ' 62 63 cat >expect <<\EOF 64 + b1 [origin/main: ahead 1, behind 1] d 65 + b2 [origin/main: ahead 1, behind 1] d 66 + b3 [origin/main: behind 1] b 67 + b4 [origin/main: ahead 2] f 68 b5 [brokenbase: gone] g 69 + b6 [origin/main] c 70 EOF 71 72 test_expect_success 'branch -vv' ' ··· 86 ' 87 88 test_expect_success 'checkout with local tracked branch' ' 89 + git checkout main && 90 git checkout follower >actual && 91 test_i18ngrep "is ahead of" actual 92 ' ··· 103 ( 104 cd test && git checkout b6 105 ) >actual && 106 + test_i18ngrep "Your branch is up to date with .origin/main" actual 107 ' 108 109 test_expect_success 'status (diverged from upstream)' ' ··· 133 # reports nothing to commit 134 test_must_fail git commit --dry-run 135 ) >actual && 136 + test_i18ngrep "Your branch is up to date with .origin/main" actual 137 ' 138 139 cat >expect <<\EOF 140 + ## b1...origin/main [ahead 1, behind 1] 141 EOF 142 143 test_expect_success 'status -s -b (diverged from upstream)' ' ··· 150 ' 151 152 cat >expect <<\EOF 153 + ## b1...origin/main [different] 154 EOF 155 156 test_expect_success 'status -s -b --no-ahead-behind (diverged from upstream)' ' ··· 163 ' 164 165 cat >expect <<\EOF 166 + ## b1...origin/main [different] 167 EOF 168 169 test_expect_success 'status.aheadbehind=false status -s -b (diverged from upstream)' ' ··· 177 178 cat >expect <<\EOF 179 On branch b1 180 + Your branch and 'origin/main' have diverged, 181 and have 1 and 1 different commits each, respectively. 182 EOF 183 ··· 201 202 cat >expect <<\EOF 203 On branch b1 204 + Your branch and 'origin/main' refer to different commits. 205 EOF 206 207 test_expect_success 'status --long --branch --no-ahead-behind' ' ··· 236 ' 237 238 cat >expect <<\EOF 239 + ## b6...origin/main 240 EOF 241 242 test_expect_success 'status -s -b (up-to-date with upstream)' ' ··· 249 ' 250 251 test_expect_success 'fail to track lightweight tags' ' 252 + git checkout main && 253 git tag light && 254 test_must_fail git branch --track lighttrack light >actual && 255 test_i18ngrep ! "set up to track" actual && ··· 257 ' 258 259 test_expect_success 'fail to track annotated tags' ' 260 + git checkout main && 261 git tag -m heavy heavy && 262 test_must_fail git branch --track heavytrack heavy >actual && 263 test_i18ngrep ! "set up to track" actual && ··· 265 ' 266 267 test_expect_success '--set-upstream-to does not change branch' ' 268 + git branch from-main main && 269 + git branch --set-upstream-to main from-main && 270 + git branch from-topic_2 main && 271 test_must_fail git config branch.from-topic_2.merge > actual && 272 git rev-list from-topic_2 && 273 git update-ref refs/heads/from-topic_2 from-topic_2^ && 274 git rev-parse from-topic_2 >expect2 && 275 + git branch --set-upstream-to main from-topic_2 && 276 + git config branch.from-main.merge > actual && 277 git rev-parse from-topic_2 >actual2 && 278 + grep -q "^refs/heads/main$" actual && 279 cmp expect2 actual2 280 ' 281 ··· 283 git checkout follower && 284 git checkout from-topic_2 && 285 git config branch.from-topic_2.merge > expect2 && 286 + git branch --set-upstream-to @{-1} from-main && 287 + git config branch.from-main.merge > actual && 288 git config branch.from-topic_2.merge > actual2 && 289 + git branch --set-upstream-to follower from-main && 290 + git config branch.from-main.merge > expect && 291 test_cmp expect2 actual2 && 292 test_cmp expect actual 293 '
+6 -6
t/t6050-replace.sh
··· 4 # 5 test_description='Tests replace refs functionality' 6 7 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 8 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 9 10 . ./test-lib.sh ··· 136 ' 137 138 test_expect_success '"git fsck" works' ' 139 - git fsck master >fsck_master.out && 140 - test_i18ngrep "dangling commit $R" fsck_master.out && 141 - test_i18ngrep "dangling tag $(git show-ref -s refs/tags/mytag)" fsck_master.out && 142 test -z "$(git fsck)" 143 ' 144 ··· 221 git cherry-pick $HASH6 && 222 PARA6=$(git rev-parse --verify HEAD) && 223 git replace $HASH6 $PARA6 && 224 - git checkout master && 225 cur=$(git rev-parse --verify HEAD) && 226 test "$cur" = "$HASH7" && 227 git log --pretty=oneline | grep $PARA2 && ··· 464 git commit -m "hello: 2 more lines from a test branch" && 465 HASH9=$(git rev-parse --verify HEAD) && 466 git tag -s -m "tag for testing with a mergetag" test_tag HEAD && 467 - git checkout master && 468 git merge -s ours test_tag && 469 HASH10=$(git rev-parse --verify HEAD) && 470 git cat-file commit $HASH10 | grep "^mergetag object"
··· 4 # 5 test_description='Tests replace refs functionality' 6 7 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 8 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 9 10 . ./test-lib.sh ··· 136 ' 137 138 test_expect_success '"git fsck" works' ' 139 + git fsck main >fsck_main.out && 140 + test_i18ngrep "dangling commit $R" fsck_main.out && 141 + test_i18ngrep "dangling tag $(git show-ref -s refs/tags/mytag)" fsck_main.out && 142 test -z "$(git fsck)" 143 ' 144 ··· 221 git cherry-pick $HASH6 && 222 PARA6=$(git rev-parse --verify HEAD) && 223 git replace $HASH6 $PARA6 && 224 + git checkout main && 225 cur=$(git rev-parse --verify HEAD) && 226 test "$cur" = "$HASH7" && 227 git log --pretty=oneline | grep $PARA2 && ··· 464 git commit -m "hello: 2 more lines from a test branch" && 465 HASH9=$(git rev-parse --verify HEAD) && 466 git tag -s -m "tag for testing with a mergetag" test_tag HEAD && 467 + git checkout main && 468 git merge -s ours test_tag && 469 HASH10=$(git rev-parse --verify HEAD) && 470 git cat-file commit $HASH10 | grep "^mergetag object"
+2 -2
t/t6101-rev-parse-parents.sh
··· 5 6 test_description='Test git rev-parse with different parent options' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 21 test_commit second && 22 git checkout --orphan tmp && 23 test_commit start2 && 24 - git checkout master && 25 git merge -m next --allow-unrelated-histories start2 && 26 test_commit final && 27
··· 5 6 test_description='Test git rev-parse with different parent options' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 21 test_commit second && 22 git checkout --orphan tmp && 23 test_commit start2 && 24 + git checkout main && 25 git merge -m next --allow-unrelated-histories start2 && 26 test_commit final && 27
+2 -2
t/t6110-rev-list-sparse.sh
··· 1 #!/bin/sh 2 3 test_description='operations that cull histories in unusual ways' 4 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 13 git checkout -b side HEAD^ && 14 test_commit D && 15 test_commit E && 16 - git merge master 17 ' 18 19 test_expect_success 'rev-list --first-parent --boundary' '
··· 1 #!/bin/sh 2 3 test_description='operations that cull histories in unusual ways' 4 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 6 7 . ./test-lib.sh ··· 13 git checkout -b side HEAD^ && 14 test_commit D && 15 test_commit E && 16 + git merge main 17 ' 18 19 test_expect_success 'rev-list --first-parent --boundary' '
+4 -4
t/t6111-rev-list-treesame.sh
··· 13 14 test_description='TREESAME and limiting' 15 16 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 17 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 18 19 . ./test-lib.sh ··· 36 git checkout other-branch && 37 test_commit "Added other" other "Hello" C && 38 39 - git checkout master && 40 test_merge D other-branch && 41 42 git checkout third-branch && 43 test_commit "Third file" third "Nothing" E && 44 45 - git checkout master && 46 test_commit "file=Blah" file "Blah" F && 47 48 test_tick && git merge --no-commit third-branch && ··· 59 60 test_tick && git revert I && note J && 61 62 - git checkout master && 63 test_tick && git merge --no-ff fiddler-branch && 64 note K && 65
··· 13 14 test_description='TREESAME and limiting' 15 16 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 17 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 18 19 . ./test-lib.sh ··· 36 git checkout other-branch && 37 test_commit "Added other" other "Hello" C && 38 39 + git checkout main && 40 test_merge D other-branch && 41 42 git checkout third-branch && 43 test_commit "Third file" third "Nothing" E && 44 45 + git checkout main && 46 test_commit "file=Blah" file "Blah" F && 47 48 test_tick && git merge --no-commit third-branch && ··· 59 60 test_tick && git revert I && note J && 61 62 + git checkout main && 63 test_tick && git merge --no-ff fiddler-branch && 64 note K && 65
+8 -8
t/t6112-rev-list-filters-objects.sh
··· 2 3 test_description='git rev-list using object filtering' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 226 sort >expected && 227 228 git -C r3 rev-list --quiet --objects --filter-print-omitted \ 229 - --filter=sparse:oid=master:pattern HEAD >revs && 230 awk -f print_1.awk revs | 231 sed "s/~//" | 232 sort >observed && ··· 439 440 test_expect_success 'combine:... with more than two sub-filters' ' 441 git -C r3 rev-list --objects \ 442 - --filter=combine:tree:3+blob:limit=40+sparse:oid=master:pattern \ 443 HEAD >actual && 444 445 expect_has HEAD "" && ··· 457 cp actual expect && 458 459 git -C r3 rev-list --objects \ 460 - --filter=combine:tree:3+blob:limit=40+sparse:oid=master:pattern1%2brenamed%25 \ 461 HEAD >actual && 462 test_cmp expect actual && 463 ··· 467 test_when_finished "rm -f trace1" && 468 GIT_TRACE=$(pwd)/trace1 git -C r3 rev-list --objects \ 469 --filter=tree:3 --filter=blob:limit=40 \ 470 - --filter=sparse:oid="master:p;at%ter+n" \ 471 HEAD >actual && 472 473 test_cmp expect actual && 474 - grep "Add to combine filter-spec: sparse:oid=master:p%3bat%25ter%2bn" \ 475 trace1 && 476 477 # Repeat the above test, but this time, the characters to encode are in 478 # the LHS of the combined filter. 479 test_when_finished "rm -f trace2" && 480 GIT_TRACE=$(pwd)/trace2 git -C r3 rev-list --objects \ 481 - --filter=sparse:oid=master:^~pattern \ 482 --filter=tree:3 --filter=blob:limit=40 \ 483 HEAD >actual && 484 485 test_cmp expect actual && 486 - grep "Add to combine filter-spec: sparse:oid=master:%5e%7epattern" \ 487 trace2 488 ' 489
··· 2 3 test_description='git rev-list using object filtering' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 226 sort >expected && 227 228 git -C r3 rev-list --quiet --objects --filter-print-omitted \ 229 + --filter=sparse:oid=main:pattern HEAD >revs && 230 awk -f print_1.awk revs | 231 sed "s/~//" | 232 sort >observed && ··· 439 440 test_expect_success 'combine:... with more than two sub-filters' ' 441 git -C r3 rev-list --objects \ 442 + --filter=combine:tree:3+blob:limit=40+sparse:oid=main:pattern \ 443 HEAD >actual && 444 445 expect_has HEAD "" && ··· 457 cp actual expect && 458 459 git -C r3 rev-list --objects \ 460 + --filter=combine:tree:3+blob:limit=40+sparse:oid=main:pattern1%2brenamed%25 \ 461 HEAD >actual && 462 test_cmp expect actual && 463 ··· 467 test_when_finished "rm -f trace1" && 468 GIT_TRACE=$(pwd)/trace1 git -C r3 rev-list --objects \ 469 --filter=tree:3 --filter=blob:limit=40 \ 470 + --filter=sparse:oid="main:p;at%ter+n" \ 471 HEAD >actual && 472 473 test_cmp expect actual && 474 + grep "Add to combine filter-spec: sparse:oid=main:p%3bat%25ter%2bn" \ 475 trace1 && 476 477 # Repeat the above test, but this time, the characters to encode are in 478 # the LHS of the combined filter. 479 test_when_finished "rm -f trace2" && 480 GIT_TRACE=$(pwd)/trace2 git -C r3 rev-list --objects \ 481 + --filter=sparse:oid=main:^~pattern \ 482 --filter=tree:3 --filter=blob:limit=40 \ 483 HEAD >actual && 484 485 test_cmp expect actual && 486 + grep "Add to combine filter-spec: sparse:oid=main:%5e%7epattern" \ 487 trace2 488 ' 489
+11 -11
t/t6120-describe.sh
··· 11 # 12 # First parent of a merge commit is on the same line, second parent below. 13 14 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 15 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 16 17 . ./test-lib.sh ··· 105 check_describe B --tags HEAD^^2^ 106 check_describe e --tags HEAD^^^ 107 108 - check_describe heads/master --all HEAD 109 check_describe tags/c-* --all HEAD^ 110 check_describe tags/e --all HEAD^^^ 111 ··· 406 i=1 && 407 while test $i -lt 8000 408 do 409 - echo "commit refs/heads/master 410 committer A U Thor <author@example.com> $((1000000000 + $i * 100)) +0200 411 data <<EOF 412 commit #$i 413 EOF" 414 - test $i = 1 && echo "from refs/heads/master^0" 415 i=$(($i + 1)) 416 done | git fast-import && 417 - git checkout master && 418 git tag far-far-away HEAD^ && 419 echo "HEAD~4000 tags/far-far-away~3999" >expect && 420 git name-rev HEAD~4000 >actual && ··· 445 ' 446 447 test_expect_success 'name-rev a rev shortly after epoch' ' 448 - test_when_finished "git checkout master" && 449 450 git checkout --orphan no-timestamp-underflow && 451 # Any date closer to epoch than the CUTOFF_DATE_SLOP constant ··· 459 test_cmp expect actual 460 ' 461 462 - # A--------------master 463 # \ / 464 # \----------M2 465 # \ / ··· 490 git checkout $A && 491 git merge --no-ff HEAD@{1} && # M2 492 493 - git checkout master && 494 git merge --no-ff HEAD@{1} && 495 496 - echo "$B master^2^2~1^2" >expect && 497 git name-rev $B >actual && 498 499 test_cmp expect actual ··· 519 git checkout --orphan branch && rm file && 520 echo B > file2 && git add file2 && git commit -m B && 521 git tag B -a -m B && 522 - git merge --no-ff --allow-unrelated-histories master -m x && 523 524 check_describe "A-3-*" HEAD 525 ) ··· 545 echo o >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:01" git commit -m o && 546 echo B >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:02" git commit -m B && 547 git tag B -a -m B && 548 - git merge --no-ff --allow-unrelated-histories master -m x && 549 550 check_describe "B-3-*" HEAD 551 )
··· 11 # 12 # First parent of a merge commit is on the same line, second parent below. 13 14 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 15 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 16 17 . ./test-lib.sh ··· 105 check_describe B --tags HEAD^^2^ 106 check_describe e --tags HEAD^^^ 107 108 + check_describe heads/main --all HEAD 109 check_describe tags/c-* --all HEAD^ 110 check_describe tags/e --all HEAD^^^ 111 ··· 406 i=1 && 407 while test $i -lt 8000 408 do 409 + echo "commit refs/heads/main 410 committer A U Thor <author@example.com> $((1000000000 + $i * 100)) +0200 411 data <<EOF 412 commit #$i 413 EOF" 414 + test $i = 1 && echo "from refs/heads/main^0" 415 i=$(($i + 1)) 416 done | git fast-import && 417 + git checkout main && 418 git tag far-far-away HEAD^ && 419 echo "HEAD~4000 tags/far-far-away~3999" >expect && 420 git name-rev HEAD~4000 >actual && ··· 445 ' 446 447 test_expect_success 'name-rev a rev shortly after epoch' ' 448 + test_when_finished "git checkout main" && 449 450 git checkout --orphan no-timestamp-underflow && 451 # Any date closer to epoch than the CUTOFF_DATE_SLOP constant ··· 459 test_cmp expect actual 460 ' 461 462 + # A--------------main 463 # \ / 464 # \----------M2 465 # \ / ··· 490 git checkout $A && 491 git merge --no-ff HEAD@{1} && # M2 492 493 + git checkout main && 494 git merge --no-ff HEAD@{1} && 495 496 + echo "$B main^2^2~1^2" >expect && 497 git name-rev $B >actual && 498 499 test_cmp expect actual ··· 519 git checkout --orphan branch && rm file && 520 echo B > file2 && git add file2 && git commit -m B && 521 git tag B -a -m B && 522 + git merge --no-ff --allow-unrelated-histories main -m x && 523 524 check_describe "A-3-*" HEAD 525 ) ··· 545 echo o >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:01" git commit -m o && 546 echo B >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:02" git commit -m B && 547 git tag B -a -m B && 548 + git merge --no-ff --allow-unrelated-histories main -m x && 549 550 check_describe "B-3-*" HEAD 551 )
+26 -26
t/t6200-fmt-merge-msg.sh
··· 5 6 test_description='fmt-merge-msg test' 7 8 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 84 test_expect_success 'message for merging local branch' ' 85 echo "Merge branch ${apos}left${apos}" >expected && 86 87 - git checkout master && 88 git fetch . left && 89 90 git fmt-merge-msg <.git/FETCH_HEAD >actual && ··· 92 ' 93 94 test_expect_success GPG 'message for merging local tag signed by good key' ' 95 - git checkout master && 96 git fetch . signed-good-tag && 97 git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 && 98 grep "^Merge tag ${apos}signed-good-tag${apos}" actual && ··· 101 ' 102 103 test_expect_success GPG 'message for merging local tag signed by unknown key' ' 104 - git checkout master && 105 git fetch . signed-good-tag && 106 GNUPGHOME=. git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 && 107 grep "^Merge tag ${apos}signed-good-tag${apos}" actual && ··· 112 test_expect_success 'message for merging external branch' ' 113 echo "Merge branch ${apos}left${apos} of $(pwd)" >expected && 114 115 - git checkout master && 116 git fetch "$(pwd)" left && 117 118 git fmt-merge-msg <.git/FETCH_HEAD >actual && ··· 136 test_config merge.log true && 137 test_unconfig merge.summary && 138 139 - git checkout master && 140 test_tick && 141 git fetch . left && 142 ··· 145 test_unconfig merge.log && 146 test_config merge.summary true && 147 148 - git checkout master && 149 test_tick && 150 git fetch . left && 151 ··· 156 ' 157 158 test_expect_success 'setup FETCH_HEAD' ' 159 - git checkout master && 160 test_tick && 161 git fetch . left 162 ' ··· 284 285 test_unconfig merge.log && 286 test_unconfig merge.summary && 287 - git checkout master && 288 git fetch "$(pwd)" left && 289 git fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual && 290 git fmt-merge-msg --log -m "Sync with left" \ ··· 326 test_expect_success 'shortlog for two branches' ' 327 test_config merge.log true && 328 test_unconfig merge.summary && 329 - git checkout master && 330 test_tick && 331 git fetch . left right && 332 git fmt-merge-msg <.git/FETCH_HEAD >actual1 && 333 334 test_unconfig merge.log && 335 test_config merge.summary true && 336 - git checkout master && 337 test_tick && 338 git fetch . left right && 339 git fmt-merge-msg <.git/FETCH_HEAD >actual2 && 340 341 test_config merge.log yes && 342 test_unconfig merge.summary && 343 - git checkout master && 344 test_tick && 345 git fetch . left right && 346 git fmt-merge-msg <.git/FETCH_HEAD >actual3 && 347 348 test_unconfig merge.log && 349 test_config merge.summary yes && 350 - git checkout master && 351 test_tick && 352 git fetch . left right && 353 git fmt-merge-msg <.git/FETCH_HEAD >actual4 && ··· 361 test_expect_success 'merge-msg -F' ' 362 test_unconfig merge.log && 363 test_config merge.summary yes && 364 - git checkout master && 365 test_tick && 366 git fetch . left right && 367 git fmt-merge-msg -F .git/FETCH_HEAD >actual && ··· 371 test_expect_success 'merge-msg -F in subdirectory' ' 372 test_unconfig merge.log && 373 test_config merge.summary yes && 374 - git checkout master && 375 test_tick && 376 git fetch . left right && 377 mkdir sub && ··· 411 test_unconfig merge.log && 412 test_config merge.summary yes && 413 414 - git checkout master && 415 test_tick && 416 git fetch . tag tag-r3 && 417 ··· 441 test_unconfig merge.log && 442 test_config merge.summary yes && 443 444 - git checkout master && 445 test_tick && 446 git fetch . tag tag-r3 tag tag-l5 && 447 ··· 471 test_unconfig merge.log && 472 test_config merge.summary yes && 473 474 - git checkout master && 475 test_tick && 476 git fetch . tag tag-r3 left && 477 ··· 498 499 test_config merge.summary yes && 500 501 - git checkout master && 502 test_tick && 503 git fetch . long && 504 ··· 509 test_expect_success 'merge-msg with "merging" an annotated tag' ' 510 test_config merge.log true && 511 512 - git checkout master^0 && 513 git commit --allow-empty -m "One step ahead" && 514 git tag -a -m "An annotated one" annote HEAD && 515 516 - git checkout master && 517 git fetch . annote && 518 519 git fmt-merge-msg <.git/FETCH_HEAD >actual && ··· 546 ' 547 548 test_expect_success 'merge.suppressDest configuration' ' 549 - git checkout -B side master && 550 git commit --allow-empty -m "One step ahead" && 551 - git checkout master && 552 git fetch . side && 553 554 git -c merge.suppressDest="" fmt-merge-msg <.git/FETCH_HEAD >full.1 && 555 head -n1 full.1 >actual && 556 - grep -e "Merge branch .side. into master" actual && 557 558 git -c merge.suppressDest="mast" fmt-merge-msg <.git/FETCH_HEAD >full.2 && 559 head -n1 full.2 >actual && 560 - grep -e "Merge branch .side. into master$" actual && 561 562 git -c merge.suppressDest="ma?*[rn]" fmt-merge-msg <.git/FETCH_HEAD >full.3 && 563 head -n1 full.3 >actual && 564 grep -e "Merge branch .side." actual && 565 - ! grep -e " into master$" actual 566 ' 567 568 test_done
··· 5 6 test_description='fmt-merge-msg test' 7 8 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh ··· 84 test_expect_success 'message for merging local branch' ' 85 echo "Merge branch ${apos}left${apos}" >expected && 86 87 + git checkout main && 88 git fetch . left && 89 90 git fmt-merge-msg <.git/FETCH_HEAD >actual && ··· 92 ' 93 94 test_expect_success GPG 'message for merging local tag signed by good key' ' 95 + git checkout main && 96 git fetch . signed-good-tag && 97 git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 && 98 grep "^Merge tag ${apos}signed-good-tag${apos}" actual && ··· 101 ' 102 103 test_expect_success GPG 'message for merging local tag signed by unknown key' ' 104 + git checkout main && 105 git fetch . signed-good-tag && 106 GNUPGHOME=. git fmt-merge-msg <.git/FETCH_HEAD >actual 2>&1 && 107 grep "^Merge tag ${apos}signed-good-tag${apos}" actual && ··· 112 test_expect_success 'message for merging external branch' ' 113 echo "Merge branch ${apos}left${apos} of $(pwd)" >expected && 114 115 + git checkout main && 116 git fetch "$(pwd)" left && 117 118 git fmt-merge-msg <.git/FETCH_HEAD >actual && ··· 136 test_config merge.log true && 137 test_unconfig merge.summary && 138 139 + git checkout main && 140 test_tick && 141 git fetch . left && 142 ··· 145 test_unconfig merge.log && 146 test_config merge.summary true && 147 148 + git checkout main && 149 test_tick && 150 git fetch . left && 151 ··· 156 ' 157 158 test_expect_success 'setup FETCH_HEAD' ' 159 + git checkout main && 160 test_tick && 161 git fetch . left 162 ' ··· 284 285 test_unconfig merge.log && 286 test_unconfig merge.summary && 287 + git checkout main && 288 git fetch "$(pwd)" left && 289 git fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual && 290 git fmt-merge-msg --log -m "Sync with left" \ ··· 326 test_expect_success 'shortlog for two branches' ' 327 test_config merge.log true && 328 test_unconfig merge.summary && 329 + git checkout main && 330 test_tick && 331 git fetch . left right && 332 git fmt-merge-msg <.git/FETCH_HEAD >actual1 && 333 334 test_unconfig merge.log && 335 test_config merge.summary true && 336 + git checkout main && 337 test_tick && 338 git fetch . left right && 339 git fmt-merge-msg <.git/FETCH_HEAD >actual2 && 340 341 test_config merge.log yes && 342 test_unconfig merge.summary && 343 + git checkout main && 344 test_tick && 345 git fetch . left right && 346 git fmt-merge-msg <.git/FETCH_HEAD >actual3 && 347 348 test_unconfig merge.log && 349 test_config merge.summary yes && 350 + git checkout main && 351 test_tick && 352 git fetch . left right && 353 git fmt-merge-msg <.git/FETCH_HEAD >actual4 && ··· 361 test_expect_success 'merge-msg -F' ' 362 test_unconfig merge.log && 363 test_config merge.summary yes && 364 + git checkout main && 365 test_tick && 366 git fetch . left right && 367 git fmt-merge-msg -F .git/FETCH_HEAD >actual && ··· 371 test_expect_success 'merge-msg -F in subdirectory' ' 372 test_unconfig merge.log && 373 test_config merge.summary yes && 374 + git checkout main && 375 test_tick && 376 git fetch . left right && 377 mkdir sub && ··· 411 test_unconfig merge.log && 412 test_config merge.summary yes && 413 414 + git checkout main && 415 test_tick && 416 git fetch . tag tag-r3 && 417 ··· 441 test_unconfig merge.log && 442 test_config merge.summary yes && 443 444 + git checkout main && 445 test_tick && 446 git fetch . tag tag-r3 tag tag-l5 && 447 ··· 471 test_unconfig merge.log && 472 test_config merge.summary yes && 473 474 + git checkout main && 475 test_tick && 476 git fetch . tag tag-r3 left && 477 ··· 498 499 test_config merge.summary yes && 500 501 + git checkout main && 502 test_tick && 503 git fetch . long && 504 ··· 509 test_expect_success 'merge-msg with "merging" an annotated tag' ' 510 test_config merge.log true && 511 512 + git checkout main^0 && 513 git commit --allow-empty -m "One step ahead" && 514 git tag -a -m "An annotated one" annote HEAD && 515 516 + git checkout main && 517 git fetch . annote && 518 519 git fmt-merge-msg <.git/FETCH_HEAD >actual && ··· 546 ' 547 548 test_expect_success 'merge.suppressDest configuration' ' 549 + git checkout -B side main && 550 git commit --allow-empty -m "One step ahead" && 551 + git checkout main && 552 git fetch . side && 553 554 git -c merge.suppressDest="" fmt-merge-msg <.git/FETCH_HEAD >full.1 && 555 head -n1 full.1 >actual && 556 + grep -e "Merge branch .side. into main" actual && 557 558 git -c merge.suppressDest="mast" fmt-merge-msg <.git/FETCH_HEAD >full.2 && 559 head -n1 full.2 >actual && 560 + grep -e "Merge branch .side. into main$" actual && 561 562 git -c merge.suppressDest="ma?*[rn]" fmt-merge-msg <.git/FETCH_HEAD >full.3 && 563 head -n1 full.3 >actual && 564 grep -e "Merge branch .side." actual && 565 + ! grep -e " into main$" actual 566 ' 567 568 test_done
+24 -24
t/t6302-for-each-ref-filter.sh
··· 2 3 test_description='test for-each-refs usage of ref-filter APIs' 4 5 - GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 29 git tag $sign -m "A signed tag" signed-tag && 30 git tag $sign -m "Signed doubly" doubly-signed-tag signed-tag && 31 32 - git checkout master && 33 - git update-ref refs/odd/spot master 34 ' 35 36 test_expect_success 'filtering with --points-at' ' 37 cat >expect <<-\EOF && 38 - refs/heads/master 39 refs/odd/spot 40 refs/tags/three 41 EOF 42 - git for-each-ref --format="%(refname)" --points-at=master >actual && 43 test_cmp expect actual 44 ' 45 ··· 56 57 test_expect_success 'filtering with --merged' ' 58 cat >expect <<-\EOF && 59 - refs/heads/master 60 refs/odd/spot 61 refs/tags/one 62 refs/tags/three 63 refs/tags/two 64 EOF 65 - git for-each-ref --format="%(refname)" --merged=master >actual && 66 test_cmp expect actual 67 ' 68 ··· 75 refs/tags/four 76 refs/tags/signed-tag 77 EOF 78 - git for-each-ref --format="%(refname)" --no-merged=master >actual && 79 test_cmp expect actual 80 ' 81 82 test_expect_success 'filtering with --contains' ' 83 cat >expect <<-\EOF && 84 - refs/heads/master 85 refs/heads/side 86 refs/odd/spot 87 refs/tags/annotated-tag ··· 254 255 test_expect_success 'check `%(contents:lines=1)`' ' 256 cat >expect <<-\EOF && 257 - master |three 258 side |four 259 odd/spot |three 260 annotated-tag |An annotated tag ··· 272 273 test_expect_success 'check `%(contents:lines=0)`' ' 274 cat >expect <<-\EOF && 275 - master | 276 side | 277 odd/spot | 278 annotated-tag | ··· 290 291 test_expect_success 'check `%(contents:lines=99999)`' ' 292 cat >expect <<-\EOF && 293 - master |three 294 side |four 295 odd/spot |three 296 annotated-tag |An annotated tag ··· 363 test_expect_success 'check %(if)...%(then)...%(end) atoms' ' 364 git for-each-ref --format="%(refname)%(if)%(authorname)%(then) Author: %(authorname)%(end)" >actual && 365 cat >expect <<-\EOF && 366 - refs/heads/master Author: A U Thor 367 refs/heads/side Author: A U Thor 368 refs/odd/spot Author: A U Thor 369 refs/tags/annotated-tag ··· 384 test_expect_success 'check %(if)...%(then)...%(else)...%(end) atoms' ' 385 git for-each-ref --format="%(if)%(authorname)%(then)%(authorname)%(else)No author%(end): %(refname)" >actual && 386 cat >expect <<-\EOF && 387 - A U Thor: refs/heads/master 388 A U Thor: refs/heads/side 389 A U Thor: refs/odd/spot 390 No author: refs/tags/annotated-tag ··· 404 test_expect_success 'ignore spaces in %(if) atom usage' ' 405 git for-each-ref --format="%(refname:short): %(if)%(HEAD)%(then)Head ref%(else)Not Head ref%(end)" >actual && 406 cat >expect <<-\EOF && 407 - master: Head ref 408 side: Not Head ref 409 odd/spot: Not Head ref 410 annotated-tag: Not Head ref ··· 423 ' 424 425 test_expect_success 'check %(if:equals=<string>)' ' 426 - git for-each-ref --format="%(if:equals=master)%(refname:short)%(then)Found master%(else)Not master%(end)" refs/heads/ >actual && 427 cat >expect <<-\EOF && 428 - Found master 429 - Not master 430 EOF 431 test_cmp expect actual 432 ' 433 434 test_expect_success 'check %(if:notequals=<string>)' ' 435 - git for-each-ref --format="%(if:notequals=master)%(refname:short)%(then)Not master%(else)Found master%(end)" refs/heads/ >actual && 436 cat >expect <<-\EOF && 437 - Found master 438 - Not master 439 EOF 440 test_cmp expect actual 441 ' ··· 446 447 test_expect_success 'validate worktree atom' ' 448 cat >expect <<-EOF && 449 - master: $(pwd) 450 - master_worktree: $(pwd)/worktree_dir 451 side: not checked out 452 EOF 453 - git worktree add -b master_worktree worktree_dir master && 454 git for-each-ref --format="%(refname:short): %(if)%(worktreepath)%(then)%(worktreepath)%(else)not checked out%(end)" refs/heads/ >actual && 455 rm -r worktree_dir && 456 git worktree prune &&
··· 2 3 test_description='test for-each-refs usage of ref-filter APIs' 4 5 + GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh ··· 29 git tag $sign -m "A signed tag" signed-tag && 30 git tag $sign -m "Signed doubly" doubly-signed-tag signed-tag && 31 32 + git checkout main && 33 + git update-ref refs/odd/spot main 34 ' 35 36 test_expect_success 'filtering with --points-at' ' 37 cat >expect <<-\EOF && 38 + refs/heads/main 39 refs/odd/spot 40 refs/tags/three 41 EOF 42 + git for-each-ref --format="%(refname)" --points-at=main >actual && 43 test_cmp expect actual 44 ' 45 ··· 56 57 test_expect_success 'filtering with --merged' ' 58 cat >expect <<-\EOF && 59 + refs/heads/main 60 refs/odd/spot 61 refs/tags/one 62 refs/tags/three 63 refs/tags/two 64 EOF 65 + git for-each-ref --format="%(refname)" --merged=main >actual && 66 test_cmp expect actual 67 ' 68 ··· 75 refs/tags/four 76 refs/tags/signed-tag 77 EOF 78 + git for-each-ref --format="%(refname)" --no-merged=main >actual && 79 test_cmp expect actual 80 ' 81 82 test_expect_success 'filtering with --contains' ' 83 cat >expect <<-\EOF && 84 + refs/heads/main 85 refs/heads/side 86 refs/odd/spot 87 refs/tags/annotated-tag ··· 254 255 test_expect_success 'check `%(contents:lines=1)`' ' 256 cat >expect <<-\EOF && 257 + main |three 258 side |four 259 odd/spot |three 260 annotated-tag |An annotated tag ··· 272 273 test_expect_success 'check `%(contents:lines=0)`' ' 274 cat >expect <<-\EOF && 275 + main | 276 side | 277 odd/spot | 278 annotated-tag | ··· 290 291 test_expect_success 'check `%(contents:lines=99999)`' ' 292 cat >expect <<-\EOF && 293 + main |three 294 side |four 295 odd/spot |three 296 annotated-tag |An annotated tag ··· 363 test_expect_success 'check %(if)...%(then)...%(end) atoms' ' 364 git for-each-ref --format="%(refname)%(if)%(authorname)%(then) Author: %(authorname)%(end)" >actual && 365 cat >expect <<-\EOF && 366 + refs/heads/main Author: A U Thor 367 refs/heads/side Author: A U Thor 368 refs/odd/spot Author: A U Thor 369 refs/tags/annotated-tag ··· 384 test_expect_success 'check %(if)...%(then)...%(else)...%(end) atoms' ' 385 git for-each-ref --format="%(if)%(authorname)%(then)%(authorname)%(else)No author%(end): %(refname)" >actual && 386 cat >expect <<-\EOF && 387 + A U Thor: refs/heads/main 388 A U Thor: refs/heads/side 389 A U Thor: refs/odd/spot 390 No author: refs/tags/annotated-tag ··· 404 test_expect_success 'ignore spaces in %(if) atom usage' ' 405 git for-each-ref --format="%(refname:short): %(if)%(HEAD)%(then)Head ref%(else)Not Head ref%(end)" >actual && 406 cat >expect <<-\EOF && 407 + main: Head ref 408 side: Not Head ref 409 odd/spot: Not Head ref 410 annotated-tag: Not Head ref ··· 423 ' 424 425 test_expect_success 'check %(if:equals=<string>)' ' 426 + git for-each-ref --format="%(if:equals=main)%(refname:short)%(then)Found main%(else)Not main%(end)" refs/heads/ >actual && 427 cat >expect <<-\EOF && 428 + Found main 429 + Not main 430 EOF 431 test_cmp expect actual 432 ' 433 434 test_expect_success 'check %(if:notequals=<string>)' ' 435 + git for-each-ref --format="%(if:notequals=main)%(refname:short)%(then)Not main%(else)Found main%(end)" refs/heads/ >actual && 436 cat >expect <<-\EOF && 437 + Found main 438 + Not main 439 EOF 440 test_cmp expect actual 441 ' ··· 446 447 test_expect_success 'validate worktree atom' ' 448 cat >expect <<-EOF && 449 + main: $(pwd) 450 + main_worktree: $(pwd)/worktree_dir 451 side: not checked out 452 EOF 453 + git worktree add -b main_worktree worktree_dir main && 454 git for-each-ref --format="%(refname:short): %(if)%(worktreepath)%(then)%(worktreepath)%(else)not checked out%(end)" refs/heads/ >actual && 455 rm -r worktree_dir && 456 git worktree prune &&