{"thread":{"id":"55292","subject":"[PATCH] SQUASH??? allow t0031 to run with any default branch name","startedAt":"2021-03-11T18:01:55Z","lastAt":"2021-03-11T18:01:55Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"418889","messageId":"xmqqeeglefir.fsf@gitster.g","threadId":"55292","inReplyTo":null,"subject":"[PATCH] SQUASH??? allow t0031 to run with any default branch name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-11T18:01:16Z","receivedAt":"2021-03-11T18:01:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I no longer remember which step in your multi-patch series\nintroduces this script or these are built-up incrementally, but I've\nbeen carrying this patch at the tip of the series so that merging it\nto 'seen' (or any other interation branch) would not make the result\nfail depending on the hardcoded default fallback name for the first\nbranch.  Can you update your series so that I do not have to [*]?\n\nThanks.\n\n[footnote]\n\n* meaning, either squash into the commit that adds the t0031 test\n  script, if the entire test is created in a single commit, or pick\n  the parts of this patch apart and sprinkle the fixes to the commit\n  that introduces t0031 and subsequent commits that updates it.\n\n t/t0031-reftable.sh | 54 ++++++++++++++++++++++++---------------------\n 1 file changed, 29 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t0031-reftable.sh b/t/t0031-reftable.sh\nindex 58c7d5d4bc..ba0738e515 100755\n--- a/t/t0031-reftable.sh\n+++ b/t/t0031-reftable.sh\n@@ -9,23 +9,27 @@ test_description='reftable basics'\n \n INVALID_SHA1=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n \n+git_init () {\n+\tgit init -b primary \"$@\"\n+}\n+\n initialize ()  {\n \trm -rf .git &&\n-\tgit init --ref-storage=reftable &&\n+\tgit_init --ref-storage=reftable &&\n \tmv .git/hooks .git/hooks-disabled\n }\n \n test_expect_success 'SHA256 support, env' '\n \trm -rf .git &&\n \tGIT_DEFAULT_HASH=sha256 && export GIT_DEFAULT_HASH &&\n-\tgit init --ref-storage=reftable &&\n+\tgit_init --ref-storage=reftable &&\n \tmv .git/hooks .git/hooks-disabled &&\n \ttest_commit file\n '\n \n test_expect_success 'SHA256 support, option' '\n \trm -rf .git &&\n-\tgit init --ref-storage=reftable --object-format=sha256 &&\n+\tgit_init --ref-storage=reftable --object-format=sha256 &&\n \tmv .git/hooks .git/hooks-disabled &&\n \ttest_commit file\n '\n@@ -34,13 +38,13 @@ test_expect_success 'delete ref' '\n \tinitialize &&\n \ttest_commit file &&\n \tSHA=$(git show-ref -s --verify HEAD) &&\n-\ttest_write_lines \"$SHA refs/heads/master\" \"$SHA refs/tags/file\" >expect &&\n-\tgit show-ref > actual &&\n+\ttest_write_lines \"$SHA refs/heads/primary\" \"$SHA refs/tags/file\" >expect &&\n+\tgit show-ref >actual &&\n \t! git update-ref -d refs/tags/file $INVALID_SHA1 &&\n \ttest_cmp expect actual &&\n \tgit update-ref -d refs/tags/file $SHA  &&\n-\ttest_write_lines \"$SHA refs/heads/master\" >expect &&\n-\tgit show-ref > actual &&\n+\ttest_write_lines \"$SHA refs/heads/primary\" >expect &&\n+\tgit show-ref >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -54,9 +58,9 @@ test_expect_success 'clone calls transaction_initial_commit' '\n test_expect_success 'basic operation of reftable storage: commit, show-ref' '\n \tinitialize &&\n \ttest_commit file &&\n-\ttest_write_lines refs/heads/master refs/tags/file >expect &&\n+\ttest_write_lines refs/heads/primary refs/tags/file >expect &&\n \tgit show-ref &&\n-\tgit show-ref | cut -f2 -d\" \" > actual &&\n+\tgit show-ref | cut -f2 -d\" \" >actual &&\n \ttest_cmp actual expect\n '\n \n@@ -70,12 +74,12 @@ test_expect_success 'reflog, repack' '\n \tgit pack-refs &&\n \tls -1 .git/reftable >table-files &&\n \ttest_line_count = 2 table-files &&\n-\tgit reflog refs/heads/master >output &&\n+\tgit reflog refs/heads/primary >output &&\n \ttest_line_count = 10 output &&\n \tgrep \"commit (initial): number 1\" output &&\n \tgrep \"commit: number 10\" output &&\n \tgit gc &&\n-\tgit reflog refs/heads/master >output &&\n+\tgit reflog refs/heads/primary >output &&\n \ttest_line_count = 0 output\n '\n \n@@ -86,8 +90,8 @@ test_expect_success 'branch switch in reflog output' '\n \ttest_commit file2 &&\n \tgit checkout -b branch2 &&\n \tgit switch - &&\n-\tgit rev-parse --symbolic-full-name HEAD > actual &&\n-\techo refs/heads/branch1 > expect &&\n+\tgit rev-parse --symbolic-full-name HEAD >actual &&\n+\techo refs/heads/branch1 >expect &&\n \ttest_cmp actual expect\n '\n \n@@ -102,7 +106,7 @@ test_expect_success 'peeled tags are stored' '\n \ttest_commit file &&\n \tgit tag -m \"annotated tag\" test_tag HEAD &&\n \t{\n-\t\tprint_ref \"refs/heads/master\" &&\n+\t\tprint_ref \"refs/heads/primary\" &&\n \t\tprint_ref \"refs/tags/file\" &&\n \t\tprint_ref \"refs/tags/test_tag\" &&\n \t\tprint_ref \"refs/tags/test_tag^{}\"\n@@ -114,32 +118,32 @@ test_expect_success 'peeled tags are stored' '\n test_expect_success 'show-ref works on fresh repo' '\n \tinitialize &&\n \trm -rf .git &&\n-\tgit init --ref-storage=reftable &&\n+\tgit_init --ref-storage=reftable &&\n \t>expect &&\n-\t! git show-ref > actual &&\n+\t! git show-ref >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'checkout unborn branch' '\n \tinitialize &&\n-\tgit checkout -b master\n+\tgit checkout -b primary\n '\n \n \n test_expect_success 'dir/file conflict' '\n \tinitialize &&\n \ttest_commit file &&\n-\t! git branch master/forbidden\n+\t! git branch primary/forbidden\n '\n \n \n test_expect_success 'do not clobber existing repo' '\n \trm -rf .git &&\n-\tgit init --ref-storage=files &&\n-\tcat .git/HEAD > expect &&\n+\tgit_init --ref-storage=files &&\n+\tcat .git/HEAD >expect &&\n \ttest_commit file &&\n-\t(git init --ref-storage=reftable || true) &&\n-\tcat .git/HEAD > actual &&\n+\t(git_init --ref-storage=reftable || true) &&\n+\tcat .git/HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -168,7 +172,7 @@ test_expect_success 'rebase' '\n '\n \n test_expect_success 'worktrees' '\n-\tgit init --ref-storage=reftable start &&\n+\tgit_init --ref-storage=reftable start &&\n \t(cd start && test_commit file1 && git checkout -b branch1 &&\n \tgit checkout -b branch2 &&\n \tgit worktree add  ../wt\n@@ -182,13 +186,13 @@ test_expect_success 'worktrees 2' '\n \tinitialize &&\n \ttest_commit file1 &&\n \tmkdir existing_empty &&\n-\tgit worktree add --detach existing_empty master\n+\tgit worktree add --detach existing_empty primary\n '\n \n test_expect_success 'FETCH_HEAD' '\n \tinitialize &&\n \ttest_commit one &&\n-\t(git init sub && cd sub && test_commit two) &&\n+\t(git_init sub && cd sub && test_commit two) &&\n \tgit --git-dir sub/.git rev-parse HEAD >expect &&\n \tgit fetch sub &&\n \tgit checkout FETCH_HEAD &&\n-- \n2.31.0-rc2-173-g36b77366ca\n\n"}]}