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/t1406-submodule-ref-store.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 / t1406-submodule-ref-store.sh` 98 lines ยท 2237 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test submodule ref store api' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 RUN="test-tool ref-store submodule:sub" 11 12 test_expect_success 'setup' ' 13 git init sub && 14 ( 15 cd sub && 16 test_commit first && 17 git checkout -b new-main && 18 git tag -a -m new-tag new-tag HEAD 19 ) 20 ' 21 22 test_expect_success 'pack_refs() not allowed' ' 23 test_must_fail $RUN pack-refs 3 24 ' 25 26 test_expect_success 'create_symref() not allowed' ' 27 test_must_fail $RUN create-symref FOO refs/heads/main nothing 28 ' 29 30 test_expect_success 'delete_refs() not allowed' ' 31 test_must_fail $RUN delete-refs 0 nothing FOO refs/tags/new-tag 32 ' 33 34 test_expect_success 'rename_refs() not allowed' ' 35 test_must_fail $RUN rename-ref refs/heads/main refs/heads/new-main 36 ' 37 38 test_expect_success 'for_each_ref(refs/heads/)' ' 39 $RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual && 40 cat >expected <<-\EOF && 41 main 0x0 42 new-main 0x0 43 EOF 44 test_cmp expected actual 45 ' 46 47 test_expect_success 'for_each_ref() is sorted' ' 48 $RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual && 49 sort actual > expected && 50 test_cmp expected actual 51 ' 52 53 test_expect_success 'resolve_ref(main)' ' 54 SHA1=`git -C sub rev-parse main` && 55 echo "$SHA1 refs/heads/main 0x0" >expected && 56 $RUN resolve-ref refs/heads/main 0 >actual && 57 test_cmp expected actual 58 ' 59 60 test_expect_success 'verify_ref(new-main)' ' 61 $RUN verify-ref refs/heads/new-main 62 ' 63 64 test_expect_success 'for_each_reflog()' ' 65 $RUN for-each-reflog >actual && 66 cat >expected <<-\EOF && 67 HEAD 68 refs/heads/main 69 refs/heads/new-main 70 EOF 71 test_cmp expected actual 72 ' 73 74 test_expect_success 'for_each_reflog_ent()' ' 75 $RUN for-each-reflog-ent HEAD >actual && 76 head -n1 actual | grep first && 77 tail -n1 actual | grep main.to.new 78 ' 79 80 test_expect_success 'for_each_reflog_ent_reverse()' ' 81 $RUN for-each-reflog-ent-reverse HEAD >actual && 82 head -n1 actual | grep main.to.new && 83 tail -n1 actual | grep first 84 ' 85 86 test_expect_success 'reflog_exists(HEAD)' ' 87 $RUN reflog-exists HEAD 88 ' 89 90 test_expect_success 'delete_reflog() not allowed' ' 91 test_must_fail $RUN delete-reflog HEAD 92 ' 93 94 test_expect_success 'create-reflog() not allowed' ' 95 test_must_fail $RUN create-reflog HEAD 96 ' 97 98 test_done