diff options
Diffstat (limited to 't/t1407-worktree-ref-store.sh')
-rwxr-xr-x | t/t1407-worktree-ref-store.sh | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh index 9a84858118..ad8006c813 100755 --- a/t/t1407-worktree-ref-store.sh +++ b/t/t1407-worktree-ref-store.sh @@ -2,6 +2,9 @@ test_description='test worktree ref store api' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh RWT="test-tool ref-store worktree:wt" @@ -9,7 +12,7 @@ RMAIN="test-tool ref-store worktree:main" test_expect_success 'setup' ' test_commit first && - git worktree add -b wt-master wt && + git worktree add -b wt-main wt && ( cd wt && test_commit second @@ -17,39 +20,46 @@ test_expect_success 'setup' ' ' test_expect_success 'resolve_ref(<shared-ref>)' ' - SHA1=`git rev-parse master` && - echo "$SHA1 refs/heads/master 0x0" >expected && - $RWT resolve-ref refs/heads/master 0 >actual && + SHA1=`git rev-parse main` && + echo "$SHA1 refs/heads/main 0x0" >expected && + $RWT resolve-ref refs/heads/main 0 >actual && test_cmp expected actual && - $RMAIN resolve-ref refs/heads/master 0 >actual && + $RMAIN resolve-ref refs/heads/main 0 >actual && test_cmp expected actual ' test_expect_success 'resolve_ref(<per-worktree-ref>)' ' SHA1=`git -C wt rev-parse HEAD` && - echo "$SHA1 refs/heads/wt-master 0x1" >expected && + echo "$SHA1 refs/heads/wt-main 0x1" >expected && $RWT resolve-ref HEAD 0 >actual && test_cmp expected actual && SHA1=`git rev-parse HEAD` && - echo "$SHA1 refs/heads/master 0x1" >expected && + echo "$SHA1 refs/heads/main 0x1" >expected && $RMAIN resolve-ref HEAD 0 >actual && test_cmp expected actual ' -test_expect_success 'create_symref(FOO, refs/heads/master)' ' - $RWT create-symref FOO refs/heads/master nothing && - echo refs/heads/master >expected && +test_expect_success 'create_symref(FOO, refs/heads/main)' ' + $RWT create-symref FOO refs/heads/main nothing && + echo refs/heads/main >expected && git -C wt symbolic-ref FOO >actual && test_cmp expected actual && - $RMAIN create-symref FOO refs/heads/wt-master nothing && - echo refs/heads/wt-master >expected && + $RMAIN create-symref FOO refs/heads/wt-main nothing && + echo refs/heads/wt-main >expected && git symbolic-ref FOO >actual && test_cmp expected actual ' -test_expect_success 'for_each_reflog()' ' +# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should +# only appear in the for-each-reflog output if it is called from the correct +# worktree, which is exercised in this test. This test is poorly written (and +# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly +# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3) +# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is +# not testing a realistic scenario. +test_expect_success REFFILES 'for_each_reflog()' ' echo $ZERO_OID > .git/logs/PSEUDO-MAIN && mkdir -p .git/logs/refs/bisect && echo $ZERO_OID > .git/logs/refs/bisect/random && @@ -63,8 +73,8 @@ test_expect_success 'for_each_reflog()' ' HEAD 0x1 PSEUDO-WT 0x0 refs/bisect/wt-random 0x0 - refs/heads/master 0x0 - refs/heads/wt-master 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 EOF test_cmp expected actual && @@ -73,8 +83,8 @@ test_expect_success 'for_each_reflog()' ' HEAD 0x1 PSEUDO-MAIN 0x0 refs/bisect/random 0x0 - refs/heads/master 0x0 - refs/heads/wt-master 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 EOF test_cmp expected actual ' |