{"thread":{"id":"54701","subject":"[PATCH] t3404: do not depend on any specific default branch name","startedAt":"2020-11-24T10:16:17Z","lastAt":"2020-11-24T21:16:50Z","messageCount":2,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"410650","messageId":"pull.798.git.1606212950283.gitgitgadget@gmail.com","threadId":"54701","inReplyTo":null,"subject":"[PATCH] t3404: do not depend on any specific default branch name","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-11-24T10:15:49Z","receivedAt":"2020-11-24T10:16:17Z","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\nNow that we can override the default branch name in the tests via\n`GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME`, we should avoid expecting a\nparticular hard-coded name.\n\nSo let's rename the initial branch immediately to `primary` and work\nwith that.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    t3404: do not depend on any specific default branch name\n    \n    This makes t3404-rebase-interactive.sh resilient against changing the\n    default branch name.\n    \n    Applying this patch would obsolete the change in \n    js/default-branch-name-tests-final-stretch to force the default branch\n    name to master in t3404.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-798%2Fdscho%2Ft3404-and-the-default-branch-name-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-798/dscho/t3404-and-the-default-branch-name-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/798\n\n t/t3404-rebase-interactive.sh | 89 ++++++++++++++++++-----------------\n 1 file changed, 45 insertions(+), 44 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 1e56696e4f..b06fc36159 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -12,7 +12,7 @@ Initial setup:\n \n      one - two - three - four (conflict-branch)\n    /\n- A - B - C - D - E            (master)\n+ A - B - C - D - E            (primary)\n  | \\\n  |   F - G - H                (branch1)\n  |     \\\n@@ -30,6 +30,7 @@ Initial setup:\n . \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n test_expect_success 'setup' '\n+\tgit switch -C primary &&\n \ttest_commit A file1 &&\n \ttest_commit B file1 &&\n \ttest_commit C file2 &&\n@@ -65,7 +66,7 @@ SHELL=\n export SHELL\n \n test_expect_success 'rebase --keep-empty' '\n-\tgit checkout -b emptybranch master &&\n+\tgit checkout -b emptybranch primary &&\n \tgit commit --allow-empty -m \"empty\" &&\n \tgit rebase --keep-empty -i HEAD~2 &&\n \tgit log --oneline >actual &&\n@@ -86,7 +87,7 @@ test_expect_success 'rebase -i with empty todo list' '\n '\n \n test_expect_success 'rebase -i with the exec command' '\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \t(\n \tset_fake_editor &&\n \tFAKE_LINES=\"1 exec_>touch-one\n@@ -103,12 +104,12 @@ test_expect_success 'rebase -i with the exec command' '\n \ttest_path_is_file touch-three &&\n \ttest_path_is_file \"touch-file  name with spaces\" &&\n \ttest_path_is_file touch-after-semicolon &&\n-\ttest_cmp_rev master HEAD &&\n+\ttest_cmp_rev primary HEAD &&\n \trm -f touch-*\n '\n \n test_expect_success 'rebase -i with the exec command runs from tree root' '\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \tmkdir subdir && (cd subdir &&\n \tset_fake_editor &&\n \tFAKE_LINES=\"1 exec_>touch-subdir\" \\\n@@ -121,7 +122,7 @@ test_expect_success 'rebase -i with the exec command runs from tree root' '\n test_expect_success 'rebase -i with exec allows git commands in subdirs' '\n \ttest_when_finished \"rm -rf subdir\" &&\n \ttest_when_finished \"git rebase --abort ||:\" &&\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \tmkdir subdir && (cd subdir &&\n \tset_fake_editor &&\n \tFAKE_LINES=\"1 x_cd_subdir_&&_git_rev-parse_--is-inside-work-tree\" \\\n@@ -139,13 +140,13 @@ test_expect_success 'rebase -i sets work tree properly' '\n '\n \n test_expect_success 'rebase -i with the exec command checks tree cleanness' '\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \t(\n \t\tset_fake_editor &&\n \t\ttest_must_fail env FAKE_LINES=\"exec_echo_foo_>file1 1\" \\\n \t\t\tgit rebase -i HEAD^\n \t) &&\n-\ttest_cmp_rev master^ HEAD &&\n+\ttest_cmp_rev primary^ HEAD &&\n \tgit reset --hard &&\n \tgit rebase --continue\n '\n@@ -168,7 +169,7 @@ test_expect_success 'rebase -x with newline in command fails' '\n '\n \n test_expect_success 'rebase -i with exec of inexistent command' '\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \ttest_when_finished \"git rebase --abort\" &&\n \t(\n \t\tset_fake_editor &&\n@@ -259,8 +260,8 @@ test_expect_success 'stop on conflicting pick' '\n \t>>>>>>> $commit (G)\n \tEOF\n \tgit tag new-branch1 &&\n-\ttest_must_fail git rebase -i master &&\n-\ttest \"$(git rev-parse HEAD~3)\" = \"$(git rev-parse master)\" &&\n+\ttest_must_fail git rebase -i primary &&\n+\ttest \"$(git rev-parse HEAD~3)\" = \"$(git rev-parse primary)\" &&\n \ttest_cmp expect .git/rebase-merge/patch &&\n \ttest_cmp expect2 file1 &&\n \ttest \"$(git diff --name-status |\n@@ -287,7 +288,7 @@ test_expect_success 'abort' '\n test_expect_success 'abort with error when new base cannot be checked out' '\n \tgit rm --cached file1 &&\n \tgit commit -m \"remove file in base\" &&\n-\ttest_must_fail git rebase -i master > output 2>&1 &&\n+\ttest_must_fail git rebase -i primary > output 2>&1 &&\n \ttest_i18ngrep \"The following untracked working tree files would be overwritten by checkout:\" \\\n \t\toutput &&\n \ttest_i18ngrep \"file1\" output &&\n@@ -301,7 +302,7 @@ test_expect_success 'retain authorship' '\n \ttest_tick &&\n \tGIT_AUTHOR_NAME=\"Twerp Snog\" git commit -m \"different author\" &&\n \tgit tag twerp &&\n-\tgit rebase -i --onto master HEAD^ &&\n+\tgit rebase -i --onto primary HEAD^ &&\n \tgit show HEAD | grep \"^Author: Twerp Snog\"\n '\n \n@@ -336,10 +337,10 @@ test_expect_success 'squash' '\n \t(\n \t\tset_fake_editor &&\n \t\tFAKE_LINES=\"1 squash 2\" EXPECT_HEADER_COUNT=2 \\\n-\t\t\tgit rebase -i --onto master HEAD~2\n+\t\t\tgit rebase -i --onto primary HEAD~2\n \t) &&\n \ttest B = $(cat file7) &&\n-\ttest_cmp_rev HEAD^ master\n+\ttest_cmp_rev HEAD^ primary\n '\n \n test_expect_success 'retain authorship when squashing' '\n@@ -366,12 +367,12 @@ test_expect_failure REBASE_P 'exchange two commits with -p' '\n '\n \n test_expect_success REBASE_P 'preserve merges with -p' '\n-\tgit checkout -b to-be-preserved master^ &&\n+\tgit checkout -b to-be-preserved primary^ &&\n \t: > unrelated-file &&\n \tgit add unrelated-file &&\n \ttest_tick &&\n \tgit commit -m \"unrelated\" &&\n-\tgit checkout -b another-branch master &&\n+\tgit checkout -b another-branch primary &&\n \techo B > file1 &&\n \ttest_tick &&\n \tgit commit -m J file1 &&\n@@ -394,7 +395,7 @@ test_expect_success REBASE_P 'preserve merges with -p' '\n \tgit commit -m M file1 &&\n \tgit checkout -b to-be-rebased &&\n \ttest_tick &&\n-\tgit rebase -i -p --onto branch1 master &&\n+\tgit rebase -i -p --onto branch1 primary &&\n \tgit update-index --refresh &&\n \tgit diff-files --quiet &&\n \tgit diff-index --quiet --cached HEAD -- &&\n@@ -437,7 +438,7 @@ test_expect_success '--continue tries to commit' '\n '\n \n test_expect_success 'verbose flag is heeded, even after --continue' '\n-\tgit reset --hard master@{1} &&\n+\tgit reset --hard primary@{1} &&\n \ttest_tick &&\n \ttest_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&\n \techo resolved > file1 &&\n@@ -802,7 +803,7 @@ test_expect_success 'rebase -i continue with unstaged submodule' '\n '\n \n test_expect_success 'avoid unnecessary reset' '\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \tgit reset --hard &&\n \ttest-tool chmtime =123456789 file3 &&\n \tgit update-index --refresh &&\n@@ -814,14 +815,14 @@ test_expect_success 'avoid unnecessary reset' '\n '\n \n test_expect_success 'reword' '\n-\tgit checkout -b reword-branch master &&\n+\tgit checkout -b reword-branch primary &&\n \t(\n \t\tset_fake_editor &&\n \t\tFAKE_LINES=\"1 2 3 reword 4\" FAKE_COMMIT_MESSAGE=\"E changed\" \\\n \t\t\tgit rebase -i A &&\n \t\tgit show HEAD | grep \"E changed\" &&\n-\t\ttest $(git rev-parse master) != $(git rev-parse HEAD) &&\n-\t\ttest_cmp_rev master^ HEAD^ &&\n+\t\ttest $(git rev-parse primary) != $(git rev-parse HEAD) &&\n+\t\ttest_cmp_rev primary^ HEAD^ &&\n \t\tFAKE_LINES=\"1 2 reword 3 4\" FAKE_COMMIT_MESSAGE=\"D changed\" \\\n \t\t\tgit rebase -i A &&\n \t\tgit show HEAD^ | grep \"D changed\" &&\n@@ -918,7 +919,7 @@ test_expect_success 'rebase-i history with funny messages' '\n '\n \n test_expect_success 'prepare for rebase -i --exec' '\n-\tgit checkout master &&\n+\tgit checkout primary &&\n \tgit checkout -b execute &&\n \ttest_commit one_exec main.txt one_exec &&\n \ttest_commit two_exec main.txt two_exec &&\n@@ -1027,7 +1028,7 @@ test_expect_success 'rebase -i --exec without <CMD>' '\n \tgit reset --hard execute &&\n \ttest_must_fail git rebase -i --exec 2>actual &&\n \ttest_i18ngrep \"requires a value\" actual &&\n-\tgit checkout master\n+\tgit checkout primary\n '\n \n test_expect_success 'rebase -i --root re-order and drop commits' '\n@@ -1079,7 +1080,7 @@ test_expect_success 'rebase -i --root fixup root commit' '\n \n test_expect_success 'rebase -i --root reword original root commit' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n-\tgit checkout -b reword-original-root-branch master &&\n+\tgit checkout -b reword-original-root-branch primary &&\n \t(\n \t\tset_fake_editor &&\n \t\tFAKE_LINES=\"reword 1 2\" FAKE_COMMIT_MESSAGE=\"A changed\" \\\n@@ -1091,7 +1092,7 @@ test_expect_success 'rebase -i --root reword original root commit' '\n \n test_expect_success 'rebase -i --root reword new root commit' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n-\tgit checkout -b reword-now-root-branch master &&\n+\tgit checkout -b reword-now-root-branch primary &&\n \t(\n \t\tset_fake_editor &&\n \t\tFAKE_LINES=\"reword 3 1\" FAKE_COMMIT_MESSAGE=\"C changed\" \\\n@@ -1251,7 +1252,7 @@ test_expect_success 'rebase -i error on commits with \\ in message' '\n '\n \n test_expect_success 'short commit ID setup' '\n-\ttest_when_finished \"git checkout master\" &&\n+\ttest_when_finished \"git checkout primary\" &&\n \tgit checkout --orphan collide &&\n \tgit rm -rf . &&\n \t(\n@@ -1292,7 +1293,7 @@ test_expect_success 'short commit ID collide' '\n \tt3404_collider\tsha1:ac4f2ee\n \tt3404_collider\tsha256:16697\n \tEOF\n-\ttest_when_finished \"reset_rebase && git checkout master\" &&\n+\ttest_when_finished \"reset_rebase && git checkout primary\" &&\n \tgit checkout collide &&\n \tcolliding_id=$(test_oid t3404_collision) &&\n \thexsz=$(test_oid hexsz) &&\n@@ -1416,11 +1417,11 @@ test_expect_success 'rebase --continue removes CHERRY_PICK_HEAD' '\n \n rebase_setup_and_clean () {\n \ttest_when_finished \"\n-\t\tgit checkout master &&\n+\t\tgit checkout primary &&\n \t\ttest_might_fail git branch -D $1 &&\n \t\ttest_might_fail git rebase --abort\n \t\" &&\n-\tgit checkout -b $1 ${2:-master}\n+\tgit checkout -b $1 ${2:-primary}\n }\n \n test_expect_success 'drop' '\n@@ -1451,7 +1452,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '\n \tcat >expect <<-EOF &&\n \tWarning: some commits may have been dropped accidentally.\n \tDropped commits (newer to older):\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)\n \tTo avoid this message, use \"drop\" to explicitly remove a commit.\n \tEOF\n \ttest_config rebase.missingCommitsCheck warn &&\n@@ -1469,8 +1470,8 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '\n \tcat >expect <<-EOF &&\n \tWarning: some commits may have been dropped accidentally.\n \tDropped commits (newer to older):\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master)\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master~2)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary~2)\n \tTo avoid this message, use \"drop\" to explicitly remove a commit.\n \n \tUse '\\''git config rebase.missingCommitsCheck'\\'' to change the level of warnings.\n@@ -1512,11 +1513,11 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ig\n \n test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = warn' '\n \tcat >expect <<-EOF &&\n-\terror: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 master~4)\n+\terror: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)\n \tWarning: some commits may have been dropped accidentally.\n \tDropped commits (newer to older):\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master)\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master~4)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)\n \tTo avoid this message, use \"drop\" to explicitly remove a commit.\n \tEOF\n \thead -n4 expect >expect.2 &&\n@@ -1546,11 +1547,11 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa\n \n test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = error' '\n \tcat >expect <<-EOF &&\n-\terror: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 master~4)\n+\terror: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)\n \tWarning: some commits may have been dropped accidentally.\n \tDropped commits (newer to older):\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master)\n-\t - $(git rev-list --pretty=oneline --abbrev-commit -1 master~4)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)\n+\t - $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)\n \tTo avoid this message, use \"drop\" to explicitly remove a commit.\n \n \tUse '\\''git config rebase.missingCommitsCheck'\\'' to change the level of warnings.\n@@ -1635,7 +1636,7 @@ test_expect_success 'respects rebase.abbreviateCommands with fixup, squash and e\n \t(\n \t\tset_cat_todo_editor &&\n \t\ttest_must_fail git rebase -i --exec \"git show HEAD\" \\\n-\t\t\t--autosquash master >actual\n+\t\t\t--autosquash primary >actual\n \t) &&\n \ttest_cmp expected actual\n '\n@@ -1646,7 +1647,7 @@ test_expect_success 'static check of bad command' '\n \t\tset_fake_editor &&\n \t\ttest_must_fail env FAKE_LINES=\"1 2 3 bad 4 5\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\t\ttest_i18ngrep \"badcmd $(git rev-list --oneline -1 master~1)\" \\\n+\t\ttest_i18ngrep \"badcmd $(git rev-list --oneline -1 primary~1)\" \\\n \t\t\t\tactual &&\n \t\ttest_i18ngrep \"You can fix this with .git rebase --edit-todo..\" \\\n \t\t\t\tactual &&\n@@ -1798,13 +1799,13 @@ test_expect_success 'todo has correct onto hash' '\n '\n \n test_expect_success 'ORIG_HEAD is updated correctly' '\n-\ttest_when_finished \"git checkout master && git branch -D test-orig-head\" &&\n+\ttest_when_finished \"git checkout primary && git branch -D test-orig-head\" &&\n \tgit checkout -b test-orig-head A &&\n \tgit commit --allow-empty -m A1 &&\n \tgit commit --allow-empty -m A2 &&\n \tgit commit --allow-empty -m A3 &&\n \tgit commit --allow-empty -m A4 &&\n-\tgit rebase master &&\n+\tgit rebase primary &&\n \ttest_cmp_rev ORIG_HEAD test-orig-head@{1}\n '\n \n\nbase-commit: faefdd61ec7c7f6f3c8c9907891465ac9a2a1475\n-- \ngitgitgadget\n"},{"id":"410713","messageId":"xmqqv9duihfp.fsf@gitster.c.googlers.com","threadId":"54701","inReplyTo":"pull.798.git.1606212950283.gitgitgadget@gmail.com","subject":"Re: [PATCH] t3404: do not depend on any specific default branch name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-24T21:16:42Z","receivedAt":"2020-11-24T21:16:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> Now that we can override the default branch name in the tests via\n> `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME`, we should avoid expecting a\n> particular hard-coded name.\n>\n> So let's rename the initial branch immediately to `primary` and work\n> with that.\n\nYes, that is probably the approach that gives us the most stable\nenvironment to work in.   I like it.\n\n>     Applying this patch would obsolete the change in \n>     js/default-branch-name-tests-final-stretch to force the default branch\n>     name to master in t3404.\n\nYup, after taking these individual replacement patches, I expect\nthat the big topic will see shrinkage, which is good.\n\nWill queue.  Thanks.\n"}]}