{"thread":{"id":"54775","subject":"[PATCH] t7064: avoid relying on a specific default branch name","startedAt":"2020-12-06T14:28:43Z","lastAt":"2020-12-09T13:34:21Z","messageCount":4,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"411562","messageId":"pull.811.git.1607264857628.gitgitgadget@gmail.com","threadId":"54775","inReplyTo":null,"subject":"[PATCH] t7064: avoid relying on a specific default branch name","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-12-06T14:27:37Z","receivedAt":"2020-12-06T14:28:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nTo allow us considering a change in the default bahvior of `git init`\nwhere it uses a more inclusive name for the initial branch, we must\nfirst teach the test suite not to rely on a specific default branch\nname. In this patch, we teach t7064 that trick.\n\nTo that end, we set a specific name for the initial branch. Ideally, we\nwould simply start out by calling `git branch -M initial-branch`, but\nthere is a bug in `git branch -M` that does not allow renaming branches\nunless they already have commits. This will be fixed in the\n`js/init-defaultbranch-advice` topic, and until that time, we use the\nequivalent (but less intuitive) `git checkout -f --orphan`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    t7064: avoid relying on a specific default branch name\n    \n    This one goes on top of\n    sj/untracked-files-in-submodule-directory-is-not-dirty.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-811%2Fdscho%2Ft7064-and-the-default-branch-name-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-811/dscho/t7064-and-the-default-branch-name-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/811\n\n t/t7064-wtstatus-pv2.sh | 111 ++++++++++++++++++++--------------------\n 1 file changed, 56 insertions(+), 55 deletions(-)\n\ndiff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh\nindex 78cd86be3ae..0a93f6e4c2a 100755\n--- a/t/t7064-wtstatus-pv2.sh\n+++ b/t/t7064-wtstatus-pv2.sh\n@@ -9,6 +9,7 @@ This test exercises porcelain V2 output for git status.'\n \n \n test_expect_success setup '\n+\tgit checkout -f --orphan initial-branch &&\n \ttest_tick &&\n \tgit config core.autocrlf false &&\n \techo x >file_x &&\n@@ -22,7 +23,7 @@ test_expect_success setup '\n test_expect_success 'before initial commit, nothing added, only untracked' '\n \tcat >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? dir1/\n \t? expect\n@@ -45,7 +46,7 @@ test_expect_success 'before initial commit, things added' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x\n@@ -62,7 +63,7 @@ test_expect_success 'before initial commit, things added' '\n test_expect_success 'before initial commit, things added (-z)' '\n \tlf_to_nul >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x\n@@ -81,7 +82,7 @@ test_expect_success 'make first commit, comfirm HEAD oid and branch' '\n \tH0=$(git rev-parse HEAD) &&\n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? expect\n \tEOF\n@@ -98,7 +99,7 @@ test_expect_success 'after first commit, create unstaged changes' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 .M N... 100644 100644 100644 $OID_X $OID_X file_x\n \t1 .D N... 100644 100644 000000 $OID_Z $OID_Z file_z\n \t? actual\n@@ -126,7 +127,7 @@ test_expect_success 'after first commit, stage existing changes' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t? actual\n@@ -143,7 +144,7 @@ test_expect_success 'rename causes 2 path lines' '\n \n \tq_to_tab >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y\n@@ -161,7 +162,7 @@ test_expect_success 'rename causes 2 path lines (-z)' '\n \t## Lines use NUL path separator and line terminator, so double transform here.\n \tq_to_nul <<-EOF | lf_to_nul >expect &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y\n@@ -179,7 +180,7 @@ test_expect_success 'make second commit, confirm clean and new HEAD oid' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H1\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? expect\n \tEOF\n@@ -231,7 +232,7 @@ test_expect_success 'create and commit permanent ignore file' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H1\n-\t# branch.head master\n+\t# branch.head initial-branch\n \tEOF\n \n \tgit status --porcelain=v2 --branch >actual &&\n@@ -257,14 +258,14 @@ test_expect_success 'verify --intent-to-add output' '\n test_expect_success 'verify AA (add-add) conflict' '\n \ttest_when_finished \"git reset --hard\" &&\n \n-\tgit branch AA_A master &&\n+\tgit branch AA_A initial-branch &&\n \tgit checkout AA_A &&\n \techo \"Branch AA_A\" >conflict.txt &&\n \tOID_AA_A=$(git hash-object -t blob -- conflict.txt) &&\n \tgit add conflict.txt &&\n \tgit commit -m \"branch aa_a\" &&\n \n-\tgit branch AA_B master &&\n+\tgit branch AA_B initial-branch &&\n \tgit checkout AA_B &&\n \techo \"Branch AA_B\" >conflict.txt &&\n \tOID_AA_B=$(git hash-object -t blob -- conflict.txt) &&\n@@ -290,7 +291,7 @@ test_expect_success 'verify AA (add-add) conflict' '\n test_expect_success 'verify UU (edit-edit) conflict' '\n \ttest_when_finished \"git reset --hard\" &&\n \n-\tgit branch UU_ANC master &&\n+\tgit branch UU_ANC initial-branch &&\n \tgit checkout UU_ANC &&\n \techo \"Ancestor\" >conflict.txt &&\n \tOID_UU_ANC=$(git hash-object -t blob -- conflict.txt) &&\n@@ -328,18 +329,18 @@ test_expect_success 'verify UU (edit-edit) conflict' '\n '\n \n test_expect_success 'verify upstream fields in branch header' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \ttest_when_finished \"rm -rf sub_repo\" &&\n \tgit clone . sub_repo &&\n \t(\n-\t\t## Confirm local master tracks remote master.\n+\t\t## Confirm local initial-branch tracks remote initial-branch.\n \t\tcd sub_repo &&\n \t\tHUF=$(git rev-parse HEAD) &&\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -355,8 +356,8 @@ test_expect_success 'verify upstream fields in branch header' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -367,9 +368,9 @@ test_expect_success 'verify upstream fields in branch header' '\n \t\tgit status --porcelain=v2 --untracked-files=all >actual &&\n \t\ttest_must_be_empty actual &&\n \n-\t\t## Test upstream-gone case. Fake this by pointing origin/master at\n-\t\t## a non-existing commit.\n-\t\tOLD=$(git rev-parse origin/master) &&\n+\t\t## Test upstream-gone case. Fake this by pointing\n+\t\t## origin/initial-branch at a non-existing commit.\n+\t\tOLD=$(git rev-parse origin/initial-branch) &&\n \t\tNEW=$ZERO_OID &&\n \t\tmv .git/packed-refs .git/old-packed-refs &&\n \t\tsed \"s/$OLD/$NEW/g\" <.git/old-packed-refs >.git/packed-refs &&\n@@ -378,8 +379,8 @@ test_expect_success 'verify upstream fields in branch header' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\tEOF\n \n \t\tgit status --porcelain=v2 --branch --untracked-files=all >actual &&\n@@ -388,19 +389,19 @@ test_expect_success 'verify upstream fields in branch header' '\n '\n \n test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \ttest_when_finished \"rm -rf sub_repo\" &&\n \tgit clone . sub_repo &&\n \t(\n-\t\t## Confirm local master tracks remote master.\n+\t\t## Confirm local initial-branch tracks remote initial-branch.\n \t\tcd sub_repo &&\n \t\tHUF=$(git rev-parse HEAD) &&\n \n \t\t# Confirm --no-ahead-behind reports traditional branch.ab with 0/0 for equal branches.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -410,8 +411,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --ahead-behind reports traditional branch.ab with 0/0.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -428,8 +429,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --no-ahead-behind reports branch.ab with ?/? for non-equal branches.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +? -?\n \t\tEOF\n \n@@ -439,8 +440,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --ahead-behind reports traditional branch.ab with 1/0.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -458,7 +459,7 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n '\n \n test_expect_success 'create and add submodule, submodule appears clean (A. S...)' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \tgit clone . sub_repo &&\n \tgit clone . super_repo &&\n \t(\tcd super_repo &&\n@@ -471,8 +472,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -496,8 +497,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -521,8 +522,8 @@ test_expect_success 'untracked changes in added submodule (A. S...) (untracked i\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -546,8 +547,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -573,8 +574,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -600,8 +601,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)'\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -627,8 +628,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.M.) (\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -654,8 +655,8 @@ test_expect_success 'commit within the submodule appears as new commit in super\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -677,8 +678,8 @@ test_expect_success 'stage submodule in super and commit' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -698,8 +699,8 @@ test_expect_success 'make unstaged changes in existing submodule (.M S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\t1 .M S.M. 160000 160000 160000 $HSUB $HSUB sub1\n \t\tEOF\n\nbase-commit: ffb5546b3be1cdf9e029ac373f309d0fe23ddd0b\n-- \ngitgitgadget\n"},{"id":"411603","messageId":"pull.811.v2.git.1607354380671.gitgitgadget@gmail.com","threadId":"54775","inReplyTo":"pull.811.git.1607264857628.gitgitgadget@gmail.com","subject":"[PATCH v2] t7064: avoid relying on a specific default branch name","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-12-07T15:19:40Z","receivedAt":"2020-12-07T15:20:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nTo allow us to consider a change in the default behavior of `git init`\nwhere it uses a more inclusive name for the initial branch, we must\nfirst teach the test suite not to rely on a specific default branch\nname. In this patch, we teach t7064 that trick.\n\nTo that end, we set a specific name for the initial branch. Ideally, we\nwould simply start out by calling `git branch -M initial-branch`, but\nthere is a bug in `git branch -M` that does not allow renaming branches\nunless they already have commits. This will be fixed in the\n`js/init-defaultbranch-advice` topic, and until that time, we use the\nequivalent (but less intuitive) `git checkout -f --orphan`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    t7064: avoid relying on a specific default branch name\n    \n    This one goes on top of\n    sj/untracked-files-in-submodule-directory-is-not-dirty.\n    \n    Changes since v1:\n    \n     * Fixed a typo and a grammatical construct that was not quite English\n       in the commit message.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-811%2Fdscho%2Ft7064-and-the-default-branch-name-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-811/dscho/t7064-and-the-default-branch-name-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/811\n\nRange-diff vs v1:\n\n 1:  f956ec3ba55 ! 1:  1d5591c69a5 t7064: avoid relying on a specific default branch name\n     @@ Metadata\n       ## Commit message ##\n          t7064: avoid relying on a specific default branch name\n      \n     -    To allow us considering a change in the default bahvior of `git init`\n     +    To allow us to consider a change in the default behavior of `git init`\n          where it uses a more inclusive name for the initial branch, we must\n          first teach the test suite not to rely on a specific default branch\n          name. In this patch, we teach t7064 that trick.\n\n\n t/t7064-wtstatus-pv2.sh | 111 ++++++++++++++++++++--------------------\n 1 file changed, 56 insertions(+), 55 deletions(-)\n\ndiff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh\nindex 78cd86be3ae..0a93f6e4c2a 100755\n--- a/t/t7064-wtstatus-pv2.sh\n+++ b/t/t7064-wtstatus-pv2.sh\n@@ -9,6 +9,7 @@ This test exercises porcelain V2 output for git status.'\n \n \n test_expect_success setup '\n+\tgit checkout -f --orphan initial-branch &&\n \ttest_tick &&\n \tgit config core.autocrlf false &&\n \techo x >file_x &&\n@@ -22,7 +23,7 @@ test_expect_success setup '\n test_expect_success 'before initial commit, nothing added, only untracked' '\n \tcat >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? dir1/\n \t? expect\n@@ -45,7 +46,7 @@ test_expect_success 'before initial commit, things added' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x\n@@ -62,7 +63,7 @@ test_expect_success 'before initial commit, things added' '\n test_expect_success 'before initial commit, things added (-z)' '\n \tlf_to_nul >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x\n@@ -81,7 +82,7 @@ test_expect_success 'make first commit, comfirm HEAD oid and branch' '\n \tH0=$(git rev-parse HEAD) &&\n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? expect\n \tEOF\n@@ -98,7 +99,7 @@ test_expect_success 'after first commit, create unstaged changes' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 .M N... 100644 100644 100644 $OID_X $OID_X file_x\n \t1 .D N... 100644 100644 000000 $OID_Z $OID_Z file_z\n \t? actual\n@@ -126,7 +127,7 @@ test_expect_success 'after first commit, stage existing changes' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t? actual\n@@ -143,7 +144,7 @@ test_expect_success 'rename causes 2 path lines' '\n \n \tq_to_tab >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y\n@@ -161,7 +162,7 @@ test_expect_success 'rename causes 2 path lines (-z)' '\n \t## Lines use NUL path separator and line terminator, so double transform here.\n \tq_to_nul <<-EOF | lf_to_nul >expect &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y\n@@ -179,7 +180,7 @@ test_expect_success 'make second commit, confirm clean and new HEAD oid' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H1\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? expect\n \tEOF\n@@ -231,7 +232,7 @@ test_expect_success 'create and commit permanent ignore file' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H1\n-\t# branch.head master\n+\t# branch.head initial-branch\n \tEOF\n \n \tgit status --porcelain=v2 --branch >actual &&\n@@ -257,14 +258,14 @@ test_expect_success 'verify --intent-to-add output' '\n test_expect_success 'verify AA (add-add) conflict' '\n \ttest_when_finished \"git reset --hard\" &&\n \n-\tgit branch AA_A master &&\n+\tgit branch AA_A initial-branch &&\n \tgit checkout AA_A &&\n \techo \"Branch AA_A\" >conflict.txt &&\n \tOID_AA_A=$(git hash-object -t blob -- conflict.txt) &&\n \tgit add conflict.txt &&\n \tgit commit -m \"branch aa_a\" &&\n \n-\tgit branch AA_B master &&\n+\tgit branch AA_B initial-branch &&\n \tgit checkout AA_B &&\n \techo \"Branch AA_B\" >conflict.txt &&\n \tOID_AA_B=$(git hash-object -t blob -- conflict.txt) &&\n@@ -290,7 +291,7 @@ test_expect_success 'verify AA (add-add) conflict' '\n test_expect_success 'verify UU (edit-edit) conflict' '\n \ttest_when_finished \"git reset --hard\" &&\n \n-\tgit branch UU_ANC master &&\n+\tgit branch UU_ANC initial-branch &&\n \tgit checkout UU_ANC &&\n \techo \"Ancestor\" >conflict.txt &&\n \tOID_UU_ANC=$(git hash-object -t blob -- conflict.txt) &&\n@@ -328,18 +329,18 @@ test_expect_success 'verify UU (edit-edit) conflict' '\n '\n \n test_expect_success 'verify upstream fields in branch header' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \ttest_when_finished \"rm -rf sub_repo\" &&\n \tgit clone . sub_repo &&\n \t(\n-\t\t## Confirm local master tracks remote master.\n+\t\t## Confirm local initial-branch tracks remote initial-branch.\n \t\tcd sub_repo &&\n \t\tHUF=$(git rev-parse HEAD) &&\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -355,8 +356,8 @@ test_expect_success 'verify upstream fields in branch header' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -367,9 +368,9 @@ test_expect_success 'verify upstream fields in branch header' '\n \t\tgit status --porcelain=v2 --untracked-files=all >actual &&\n \t\ttest_must_be_empty actual &&\n \n-\t\t## Test upstream-gone case. Fake this by pointing origin/master at\n-\t\t## a non-existing commit.\n-\t\tOLD=$(git rev-parse origin/master) &&\n+\t\t## Test upstream-gone case. Fake this by pointing\n+\t\t## origin/initial-branch at a non-existing commit.\n+\t\tOLD=$(git rev-parse origin/initial-branch) &&\n \t\tNEW=$ZERO_OID &&\n \t\tmv .git/packed-refs .git/old-packed-refs &&\n \t\tsed \"s/$OLD/$NEW/g\" <.git/old-packed-refs >.git/packed-refs &&\n@@ -378,8 +379,8 @@ test_expect_success 'verify upstream fields in branch header' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\tEOF\n \n \t\tgit status --porcelain=v2 --branch --untracked-files=all >actual &&\n@@ -388,19 +389,19 @@ test_expect_success 'verify upstream fields in branch header' '\n '\n \n test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \ttest_when_finished \"rm -rf sub_repo\" &&\n \tgit clone . sub_repo &&\n \t(\n-\t\t## Confirm local master tracks remote master.\n+\t\t## Confirm local initial-branch tracks remote initial-branch.\n \t\tcd sub_repo &&\n \t\tHUF=$(git rev-parse HEAD) &&\n \n \t\t# Confirm --no-ahead-behind reports traditional branch.ab with 0/0 for equal branches.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -410,8 +411,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --ahead-behind reports traditional branch.ab with 0/0.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -428,8 +429,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --no-ahead-behind reports branch.ab with ?/? for non-equal branches.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +? -?\n \t\tEOF\n \n@@ -439,8 +440,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --ahead-behind reports traditional branch.ab with 1/0.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -458,7 +459,7 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n '\n \n test_expect_success 'create and add submodule, submodule appears clean (A. S...)' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \tgit clone . sub_repo &&\n \tgit clone . super_repo &&\n \t(\tcd super_repo &&\n@@ -471,8 +472,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -496,8 +497,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -521,8 +522,8 @@ test_expect_success 'untracked changes in added submodule (A. S...) (untracked i\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -546,8 +547,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -573,8 +574,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -600,8 +601,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)'\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -627,8 +628,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.M.) (\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -654,8 +655,8 @@ test_expect_success 'commit within the submodule appears as new commit in super\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -677,8 +678,8 @@ test_expect_success 'stage submodule in super and commit' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -698,8 +699,8 @@ test_expect_success 'make unstaged changes in existing submodule (.M S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\t1 .M S.M. 160000 160000 160000 $HSUB $HSUB sub1\n \t\tEOF\n\nbase-commit: ffb5546b3be1cdf9e029ac373f309d0fe23ddd0b\n-- \ngitgitgadget\n"},{"id":"411794","messageId":"xmqq360f6hlt.fsf_-_@gitster.c.googlers.com","threadId":"54775","inReplyTo":"pull.811.v2.git.1607354380671.gitgitgadget@gmail.com","subject":"[PATCH v3] t7064: avoid relying on a specific default branch name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-12-08T22:46:54Z","receivedAt":"2020-12-08T22:48:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nTo allow us to consider a change in the default behavior of `git init`\nwhere it uses a more inclusive name for the initial branch, we must\nfirst teach the test suite not to rely on a specific default branch\nname. In this patch, we teach t7064 that trick.\n\nTo that end, we set a specific name for the initial branch. Ideally, we\nwould simply start out by calling `git branch -M initial-branch`, but\nthere is a bug in `git branch -M` that does not allow renaming branches\nunless they already have commits. This will be fixed in the\n`js/init-defaultbranch-advice` topic, and until that time, we use the\nequivalent (but less intuitive) `git checkout -f --orphan`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * v2 used to depend on an older round of a topic that is not in\n   'next' (sj/untracked-files-in-submoduledirectory-is-not-dirty).\n   As the topic stopped touching this test, I rebased the patch on\n   top of 3a0b884c (Tenth batch, 2020-12-02)\n\n t/t7064-wtstatus-pv2.sh | 103 ++++++++++++++++++++--------------------\n 1 file changed, 52 insertions(+), 51 deletions(-)\n\ndiff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh\nindex 537787e598..601b47830b 100755\n--- a/t/t7064-wtstatus-pv2.sh\n+++ b/t/t7064-wtstatus-pv2.sh\n@@ -9,6 +9,7 @@ This test exercises porcelain V2 output for git status.'\n \n \n test_expect_success setup '\n+\tgit checkout -f --orphan initial-branch &&\n \ttest_tick &&\n \tgit config core.autocrlf false &&\n \techo x >file_x &&\n@@ -22,7 +23,7 @@ test_expect_success setup '\n test_expect_success 'before initial commit, nothing added, only untracked' '\n \tcat >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? dir1/\n \t? expect\n@@ -45,7 +46,7 @@ test_expect_success 'before initial commit, things added' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x\n@@ -62,7 +63,7 @@ test_expect_success 'before initial commit, things added' '\n test_expect_success 'before initial commit, things added (-z)' '\n \tlf_to_nul >expect <<-EOF &&\n \t# branch.oid (initial)\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b\n \t1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x\n@@ -81,7 +82,7 @@ test_expect_success 'make first commit, comfirm HEAD oid and branch' '\n \tH0=$(git rev-parse HEAD) &&\n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? expect\n \tEOF\n@@ -98,7 +99,7 @@ test_expect_success 'after first commit, create unstaged changes' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 .M N... 100644 100644 100644 $OID_X $OID_X file_x\n \t1 .D N... 100644 100644 000000 $OID_Z $OID_Z file_z\n \t? actual\n@@ -126,7 +127,7 @@ test_expect_success 'after first commit, stage existing changes' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t? actual\n@@ -143,7 +144,7 @@ test_expect_success 'rename causes 2 path lines' '\n \n \tq_to_tab >expect <<-EOF &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y\n@@ -161,7 +162,7 @@ test_expect_success 'rename causes 2 path lines (-z)' '\n \t## Lines use NUL path separator and line terminator, so double transform here.\n \tq_to_nul <<-EOF | lf_to_nul >expect &&\n \t# branch.oid $H0\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x\n \t1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z\n \t2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y\n@@ -179,7 +180,7 @@ test_expect_success 'make second commit, confirm clean and new HEAD oid' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H1\n-\t# branch.head master\n+\t# branch.head initial-branch\n \t? actual\n \t? expect\n \tEOF\n@@ -231,7 +232,7 @@ test_expect_success 'create and commit permanent ignore file' '\n \n \tcat >expect <<-EOF &&\n \t# branch.oid $H1\n-\t# branch.head master\n+\t# branch.head initial-branch\n \tEOF\n \n \tgit status --porcelain=v2 --branch >actual &&\n@@ -257,14 +258,14 @@ test_expect_success 'verify --intent-to-add output' '\n test_expect_success 'verify AA (add-add) conflict' '\n \ttest_when_finished \"git reset --hard\" &&\n \n-\tgit branch AA_A master &&\n+\tgit branch AA_A initial-branch &&\n \tgit checkout AA_A &&\n \techo \"Branch AA_A\" >conflict.txt &&\n \tOID_AA_A=$(git hash-object -t blob -- conflict.txt) &&\n \tgit add conflict.txt &&\n \tgit commit -m \"branch aa_a\" &&\n \n-\tgit branch AA_B master &&\n+\tgit branch AA_B initial-branch &&\n \tgit checkout AA_B &&\n \techo \"Branch AA_B\" >conflict.txt &&\n \tOID_AA_B=$(git hash-object -t blob -- conflict.txt) &&\n@@ -290,7 +291,7 @@ test_expect_success 'verify AA (add-add) conflict' '\n test_expect_success 'verify UU (edit-edit) conflict' '\n \ttest_when_finished \"git reset --hard\" &&\n \n-\tgit branch UU_ANC master &&\n+\tgit branch UU_ANC initial-branch &&\n \tgit checkout UU_ANC &&\n \techo \"Ancestor\" >conflict.txt &&\n \tOID_UU_ANC=$(git hash-object -t blob -- conflict.txt) &&\n@@ -328,18 +329,18 @@ test_expect_success 'verify UU (edit-edit) conflict' '\n '\n \n test_expect_success 'verify upstream fields in branch header' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \ttest_when_finished \"rm -rf sub_repo\" &&\n \tgit clone . sub_repo &&\n \t(\n-\t\t## Confirm local master tracks remote master.\n+\t\t## Confirm local initial-branch tracks remote initial-branch.\n \t\tcd sub_repo &&\n \t\tHUF=$(git rev-parse HEAD) &&\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -355,8 +356,8 @@ test_expect_success 'verify upstream fields in branch header' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -367,9 +368,9 @@ test_expect_success 'verify upstream fields in branch header' '\n \t\tgit status --porcelain=v2 --untracked-files=all >actual &&\n \t\ttest_must_be_empty actual &&\n \n-\t\t## Test upstream-gone case. Fake this by pointing origin/master at\n-\t\t## a non-existing commit.\n-\t\tOLD=$(git rev-parse origin/master) &&\n+\t\t## Test upstream-gone case. Fake this by pointing\n+\t\t## origin/initial-branch at a non-existing commit.\n+\t\tOLD=$(git rev-parse origin/initial-branch) &&\n \t\tNEW=$ZERO_OID &&\n \t\tmv .git/packed-refs .git/old-packed-refs &&\n \t\tsed \"s/$OLD/$NEW/g\" <.git/old-packed-refs >.git/packed-refs &&\n@@ -378,8 +379,8 @@ test_expect_success 'verify upstream fields in branch header' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\tEOF\n \n \t\tgit status --porcelain=v2 --branch --untracked-files=all >actual &&\n@@ -388,19 +389,19 @@ test_expect_success 'verify upstream fields in branch header' '\n '\n \n test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \ttest_when_finished \"rm -rf sub_repo\" &&\n \tgit clone . sub_repo &&\n \t(\n-\t\t## Confirm local master tracks remote master.\n+\t\t## Confirm local initial-branch tracks remote initial-branch.\n \t\tcd sub_repo &&\n \t\tHUF=$(git rev-parse HEAD) &&\n \n \t\t# Confirm --no-ahead-behind reports traditional branch.ab with 0/0 for equal branches.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -410,8 +411,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --ahead-behind reports traditional branch.ab with 0/0.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\tEOF\n \n@@ -428,8 +429,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --no-ahead-behind reports branch.ab with ?/? for non-equal branches.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +? -?\n \t\tEOF\n \n@@ -439,8 +440,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n \t\t# Confirm --ahead-behind reports traditional branch.ab with 1/0.\n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HUF\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -458,7 +459,7 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '\n '\n \n test_expect_success 'create and add submodule, submodule appears clean (A. S...)' '\n-\tgit checkout master &&\n+\tgit checkout initial-branch &&\n \tgit clone . sub_repo &&\n \tgit clone . super_repo &&\n \t(\tcd super_repo &&\n@@ -471,8 +472,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -496,8 +497,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -521,8 +522,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -548,8 +549,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -575,8 +576,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)'\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -602,8 +603,8 @@ test_expect_success 'commit within the submodule appears as new commit in super\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +0 -0\n \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n \t\t1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1\n@@ -625,8 +626,8 @@ test_expect_success 'stage submodule in super and commit' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\tEOF\n \n@@ -646,8 +647,8 @@ test_expect_success 'make unstaged changes in existing submodule (.M S.M.)' '\n \n \t\tcat >expect <<-EOF &&\n \t\t# branch.oid $HSUP\n-\t\t# branch.head master\n-\t\t# branch.upstream origin/master\n+\t\t# branch.head initial-branch\n+\t\t# branch.upstream origin/initial-branch\n \t\t# branch.ab +1 -0\n \t\t1 .M S.M. 160000 160000 160000 $HSUB $HSUB sub1\n \t\tEOF\n-- \n2.29.2-624-g5c89c56a78\n\n"},{"id":"411847","messageId":"nycvar.QRO.7.76.6.2012091059480.25979@tvgsbejvaqbjf.bet","threadId":"54775","inReplyTo":"xmqq360f6hlt.fsf_-_@gitster.c.googlers.com","subject":"Re: [PATCH v3] t7064: avoid relying on a specific default branch name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-12-09T10:01:41Z","receivedAt":"2020-12-09T13:34:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Tue, 8 Dec 2020, Junio C Hamano wrote:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> To allow us to consider a change in the default behavior of `git init`\n> where it uses a more inclusive name for the initial branch, we must\n> first teach the test suite not to rely on a specific default branch\n> name. In this patch, we teach t7064 that trick.\n>\n> To that end, we set a specific name for the initial branch. Ideally, we\n> would simply start out by calling `git branch -M initial-branch`, but\n> there is a bug in `git branch -M` that does not allow renaming branches\n> unless they already have commits. This will be fixed in the\n> `js/init-defaultbranch-advice` topic, and until that time, we use the\n> equivalent (but less intuitive) `git checkout -f --orphan`.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>\n>  * v2 used to depend on an older round of a topic that is not in\n>    'next' (sj/untracked-files-in-submoduledirectory-is-not-dirty).\n>    As the topic stopped touching this test, I rebased the patch on\n>    top of 3a0b884c (Tenth batch, 2020-12-02)\n\nThank you. By doing that, I figure you increased the chances of this patch\nmaking it through the integration branches quicker. BTW just for curious\nlurkers, here is the range-diff:\n\n1:  1d5591c69a5 ! 1:  e8003bfeee7 t7064: avoid relying on a specific default branch name\n    @@ t/t7064-wtstatus-pv2.sh: test_expect_success 'untracked changes in added submodu\n      \t\t# branch.ab +0 -0\n      \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n      \t\t1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1\n    -@@ t/t7064-wtstatus-pv2.sh: test_expect_success 'untracked changes in added submodule (A. S...) (untracked i\n    -\n    - \t\tcat >expect <<-EOF &&\n    - \t\t# branch.oid $HSUP\n    --\t\t# branch.head master\n    --\t\t# branch.upstream origin/master\n    -+\t\t# branch.head initial-branch\n    -+\t\t# branch.upstream origin/initial-branch\n    - \t\t# branch.ab +0 -0\n    - \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n    - \t\t1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1\n     @@ t/t7064-wtstatus-pv2.sh: test_expect_success 'staged changes in added submodule (AM S.M.)' '\n\n      \t\tcat >expect <<-EOF &&\n    @@ t/t7064-wtstatus-pv2.sh: test_expect_success 'staged and untracked changes in ad\n      \t\t# branch.ab +0 -0\n      \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n      \t\t1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1\n    -@@ t/t7064-wtstatus-pv2.sh: test_expect_success 'staged and untracked changes in added submodule (AM S.M.) (\n    -\n    - \t\tcat >expect <<-EOF &&\n    - \t\t# branch.oid $HSUP\n    --\t\t# branch.head master\n    --\t\t# branch.upstream origin/master\n    -+\t\t# branch.head initial-branch\n    -+\t\t# branch.upstream origin/initial-branch\n    - \t\t# branch.ab +0 -0\n    - \t\t1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules\n    - \t\t1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1\n     @@ t/t7064-wtstatus-pv2.sh: test_expect_success 'commit within the submodule appears as new commit in super\n\n      \t\tcat >expect <<-EOF &&\n\nThanks,\nDscho\n"}]}