git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 00/28] Use main as default branch name

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 13, 2020, 12:55 UTC
Message-ID
<87pn4hfmc4.fsf@evledraar.gmail.com>
In-Reply-To
<pull.762.git.1605221038.gitgitgadget@gmail.com>
On Thu, Nov 12 2020, Johannes Schindelin via GitGitGadget wrote:
> This is the big one. This changes the default of init.defaultBranch to main,
> reflecting what many open source projects already did (which was followed by
> GitHub, Azure Repos and others).

I don't have an issue with the end goal of s/master/main|$whatever/ as UX here as noted in previous related review rounds. But I don't think this series as it stands is anywhere near ready.

This is 27 patches of s/master/main/ in the tests, followed by making the change to the default in refs.c without as much as a single documentation update to inform users of the change.

I don't see the point in doing these sorts of test suite changes, it just seems like needless churn. But I have not read the whole backlog of previous iterations of this & related patches, so bear with me.

Why not instead do what we did when we added protocol v2 to the tests,
e.g. in 8a1b0978ab ("test: request GIT_TEST_PROTOCOL_VERSION=0 when
appropriate", 2019-12-23) we simply set the t5515 test to always run
with protocol v1. If you'd do this:
    
    diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
    index 70a9d2d8ab..939c8b2f83 100755
    --- a/t/t5515-fetch-merge-logic.sh
    +++ b/t/t5515-fetch-merge-logic.sh
    @@ -11,6 +11,9 @@ test_description='Merge logic in fetch'
     GIT_TEST_PROTOCOL_VERSION=0
     export GIT_TEST_PROTOCOL_VERSION
     
    +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
    +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
    +
     . ./test-lib.sh
     
     build_script () {
    
Of course that also needs:
    
    index fa347ed3e1..2d700a171b 100644
    --- a/t/test-lib.sh
    +++ b/t/test-lib.sh
    @@ -1711,10 +1711,8 @@ test_lazy_prereq SHA1 '
     test_lazy_prereq REBASE_P '
     	test -z "$GIT_TEST_SKIP_REBASE_P"
     '
    -# Special-purpose prereq for transitioning to a new default branch name:
    -# Some tests need more than just a mindless (case-preserving) s/master/main/g
    -# replacement. The non-trivial adjustments are guarded behind this
    -# prerequisite, acting kind of as a feature flag
    -test_lazy_prereq PREPARE_FOR_MAIN_BRANCH '
    -	test "$GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME" = main
    +
    +test_lazy_prereq MAIN_BRANCH_IS_MASTER '
    +	test -z "$GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME" ||
    +	test "$GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME" = "master"
     '

Because (but see "later" a few paragraphs later), the logic as it stands on "master" is entirely backwards & broken. I.e. if you don't set GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME or set it to "master" we now skip a bunch of tests ... which only work if the value is "master". If you set it to "main" they'll break.

Then instead of ending up with a hardcoding of "main" we'd be able to run the tests with a new custom branch name (even one with whitespace in it). That coverage is plenty to test any branch name hardcoding.

The remaining tests that would still have "master" would then just be
dealt with by the same thing we did for the too-protocol-v1-specific
tests, i.e.:
    
    diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh
    index 8b635a196d..354f9bd851 100755
    --- a/t/t3502-cherry-pick-merge.sh
    +++ b/t/t3502-cherry-pick-merge.sh
    @@ -8,6 +8,8 @@ test_description='cherry picking and reverting a merge
     
     '
     
    +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
    +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
     . ./test-lib.sh
     
     test_expect_success setup '
    
Except unlike protocol v1/v2 we're really not gaining anything in
coverage by going further, it's not the point of any of these tests to
test for the default branch name. It's a *lot* of churn, 

"Later": After writing the above I see from 704fed9ea2 ("tests: start moving to a different default main branch name", 2020-10-23) that this state of affairs is intentional. But doesn't discuss why the more usual (because we've done it that way a few times before) v1/v2-esque transition wasn't done instead.

Doing it the other way still seems better. We're now not running our full tests in anticipation for this series landing on "master", and after applying this we're still not running all of them.

Anyway, enough with discussing this detail of the test suite churn. My main objection to this version of it is:

After this series as it stands lands what's a rather big UI change in git isn't discussed *anywhere* in the docs.

I'm not saying we need some similar s/master/main/g in Documentation/ as what's being done here in t/, but I think a bare minimum for a rather big UI change like this is:

 1) Let's at least talk about it in some way in git-init(1), i.e. that
    it used to be "master" before version so-and-so and is now
    different. With this series applied we still say:
    Documentation/git-init.txt:If not specified, fall back to the default name: `master`.
 2) Ditto in the init.defaultBranch and things like that
 3) After all this effort at eliminating "master" entirely in the tests
    we're still shipping a sample hook that expects "master" on "git
    init", and breaks now that it's "main"
And maybe stuff like:
 4) Have "git init" emit some new advice message saying that the default
    has changed and we've init-ed a new repo with a "main" branch.

Our primary concern should be the vast majority of users who don't follow this topic on Twitter, don't read this mailing list, and are just going to waste 10 minutes of their day because some script they've had working for years using "git init" did something unexpected.

Let's at least aim to make that 5 minutes instead by making the change more discoverable.

Previous: Felipe ContrerasNext: Johannes Schindelin
Message 37 of 163 in “Use main as default branch name”
  1. 00/28 Use main as default branch nameJohannes Schindelin via GitGitGadget, Nov 12, 2020
  2. 05/28 t3416: preemptively adjust alignment in a commentJohannes Schindelin via GitGitGadget, Nov 12, 2020
  3. 02/28 t[01]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  4. 04/28 t3[0-3]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  5. 03/28 t2*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  6. 06/28 t34*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  7. 09/28 t5323: prepare centered comment for `master` -> `main`Johannes Schindelin via GitGitGadget, Nov 12, 2020
  8. 01/28 t0060: preemptively adjust alignmentJohannes Schindelin via GitGitGadget, Nov 12, 2020
  9. 13/28 t551*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  10. 15/28 t55[4-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  11. 07/28 t3[5-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  12. 16/28 t5[6-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  13. 12/28 t550*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  14. 22/28 t8*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  15. 24/28 t9[5-7]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  16. 25/28 tests(git-p4): transition to the default branch name `main`Johannes Schindelin via GitGitGadget, Nov 12, 2020
  17. 28/28 Change the default branch name to `main`Don Goodman-Wilson via GitGitGadget, Nov 12, 2020
  18. Ævar Arnfjörð BjarmasonNov 13, 2020
  19. Johannes SchindelinNov 13, 2020
  20. Junio C HamanoNov 16, 2020
  21. 27/28 tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer neededJohannes Schindelin via GitGitGadget, Nov 12, 2020
  22. 26/28 t99*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  23. 23/28 t9[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  24. 14/28 t55[23]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  25. Ævar Arnfjörð BjarmasonNov 13, 2020
  26. Johannes SchindelinNov 13, 2020
  27. Junio C HamanoNov 16, 2020
  28. 11/28 t5503: prepare aligned comment for replacing `master` with `main`Johannes Schindelin via GitGitGadget, Nov 12, 2020
  29. 10/28 t5[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  30. 08/28 t4*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  31. 21/28 t7[5-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  32. 19/28 t6[4-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  33. 17/28 t6[0-3]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  34. 18/28 t64*: preemptively adjust alignment to prepare for `master` -> `main`Johannes Schindelin via GitGitGadget, Nov 12, 2020
  35. 20/28 t7[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 12, 2020
  36. Felipe ContrerasNov 13, 2020
  37. Ævar Arnfjörð BjarmasonNov 13, 2020
  38. Johannes SchindelinNov 13, 2020
  39. tests: support testing with an arbitrary default branch (sort of)Ævar Arnfjörð Bjarmason, Nov 13, 2020
  40. Jeff KingNov 13, 2020
  41. Johannes SchindelinNov 13, 2020
  42. Johannes SchindelinNov 13, 2020
  43. Ævar Arnfjörð BjarmasonNov 13, 2020
  44. Felipe ContrerasNov 14, 2020
  45. Felipe ContrerasNov 13, 2020
  46. Junio C HamanoNov 14, 2020
  47. Junio C HamanoNov 16, 2020
  48. Johannes SchindelinNov 17, 2020
  49. Junio C HamanoNov 17, 2020
  50. Johannes SchindelinNov 18, 2020
  51. 00/27 tests: use main as default branch nameJohannes Schindelin via GitGitGadget, Nov 17, 2020
  52. 01/27 t0060: preemptively adjust alignmentJohannes Schindelin via GitGitGadget, Nov 17, 2020
  53. 05/27 t3416: preemptively adjust alignment in a commentJohannes Schindelin via GitGitGadget, Nov 17, 2020
  54. 03/27 t2*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  55. 02/27 t[01]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  56. 09/27 t5323: prepare centered comment for `master` -> `main`Johannes Schindelin via GitGitGadget, Nov 17, 2020
  57. 04/27 t3[0-3]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  58. 10/27 t5[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  59. 06/27 t34*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  60. 12/27 t550*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  61. 08/27 t4*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  62. 07/27 t3[5-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  63. 13/27 t551*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  64. 16/27 t5[6-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  65. 15/27 t55[4-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  66. 14/27 t55[23]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  67. 18/27 t64*: preemptively adjust alignment to prepare for `master` -> `main`Johannes Schindelin via GitGitGadget, Nov 17, 2020
  68. 23/27 t9[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  69. 25/27 tests(git-p4): transition to the default branch name `main`Johannes Schindelin via GitGitGadget, Nov 17, 2020
  70. 22/27 t8*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  71. 24/27 t9[5-7]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  72. 27/27 tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer neededJohannes Schindelin via GitGitGadget, Nov 17, 2020
  73. 21/27 t7[5-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  74. 26/27 t99*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  75. 11/27 t5503: prepare aligned comment for replacing `master` with `main`Johannes Schindelin via GitGitGadget, Nov 17, 2020
  76. 17/27 t6[0-3]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  77. 20/27 t7[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  78. 19/27 t6[4-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 17, 2020
  79. 28/27 tests: run tests omitted by PREPARE_FOR_MAIN_BRANCHÆvar Arnfjörð Bjarmason, Nov 18, 2020
  80. Johannes SchindelinNov 18, 2020
  81. Junio C HamanoNov 19, 2020
  82. Johannes SchindelinNov 20, 2020
  83. Junio C HamanoNov 20, 2020
  84. 00/28 tests: use main as default branch nameJohannes Schindelin via GitGitGadget, Nov 18, 2020
  85. 06/28 t3416: preemptively adjust alignment in a commentJohannes Schindelin via GitGitGadget, Nov 18, 2020
  86. 02/28 t0060: preemptively adjust alignmentJohannes Schindelin via GitGitGadget, Nov 18, 2020
  87. 01/28 tests: mark tests relying on the current default for `init.defaultBranch`Johannes Schindelin via GitGitGadget, Nov 18, 2020
  88. 10/28 t5323: prepare centered comment for `master` -> `main`Johannes Schindelin via GitGitGadget, Nov 18, 2020
  89. 04/28 t2*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  90. 07/28 t34*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  91. 11/28 t5[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  92. 13/28 t550*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  93. 16/28 t55[4-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  94. 05/28 t3[0-3]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  95. 15/28 t55[23]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  96. 12/28 t5503: prepare aligned comment for replacing `master` with `main`Johannes Schindelin via GitGitGadget, Nov 18, 2020
  97. 03/28 t[01]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  98. 08/28 t3[5-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  99. 09/28 t4*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  100. 26/28 tests(git-p4): transition to the default branch name `main`Johannes Schindelin via GitGitGadget, Nov 18, 2020
  101. 14/28 t551*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  102. 25/28 t9[5-7]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  103. 23/28 t8*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  104. 24/28 t9[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  105. 27/28 t99*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  106. 20/28 t6[4-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  107. 22/28 t7[5-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  108. 28/28 tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer neededJohannes Schindelin via GitGitGadget, Nov 18, 2020
  109. 21/28 t7[0-4]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  110. 19/28 t64*: preemptively adjust alignment to prepare for `master` -> `main`Johannes Schindelin via GitGitGadget, Nov 18, 2020
  111. 17/28 t5[6-9]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  112. 18/28 t6[0-3]*: adjust the references to the default branch name "main"Johannes Schindelin via GitGitGadget, Nov 18, 2020
  113. Junio C HamanoNov 19, 2020
  114. Eric W. BiedermanNov 17, 2020
  115. Felipe ContrerasNov 17, 2020
  116. Jeff KingNov 17, 2020
  117. Junio C HamanoNov 18, 2020
  118. Jeff KingNov 18, 2020
  119. Jonathan NiederNov 18, 2020
  120. Junio C HamanoNov 18, 2020
  121. Johannes SchindelinNov 18, 2020
  122. Junio C HamanoNov 18, 2020
  123. Johannes SchindelinNov 19, 2020
  124. Felipe ContrerasNov 18, 2020
  125. Jeff KingNov 18, 2020
  126. Felipe ContrerasNov 18, 2020
  127. Jeff KingNov 18, 2020
  128. Jonathan NiederNov 18, 2020
  129. Felipe ContrerasNov 18, 2020
  130. Felipe ContrerasNov 18, 2020
  131. Junio C HamanoNov 17, 2020
  132. Felipe ContrerasNov 17, 2020
  133. Junio C HamanoNov 18, 2020
  134. Felipe ContrerasNov 18, 2020
  135. Philip OakleyNov 18, 2020
  136. Johannes SchindelinNov 19, 2020
  137. Philip OakleyNov 19, 2020
  138. Peter HadlawNov 19, 2020
  139. Philip OakleyNov 19, 2020
  140. Peter HadlawNov 19, 2020
  141. Junio C HamanoNov 19, 2020
  142. Philip OakleyNov 19, 2020
  143. Sergey OrganovNov 19, 2020
  144. Philip OakleyNov 19, 2020
  145. Sergey OrganovNov 19, 2020
  146. Junio C HamanoNov 21, 2020
  147. Sergey OrganovNov 22, 2020
  148. Philip OakleyNov 22, 2020
  149. Sergey OrganovNov 22, 2020
  150. Philip OakleyNov 22, 2020
  151. Felipe ContrerasNov 22, 2020
  152. Junio C HamanoNov 22, 2020
  153. Jonathan NiederNov 18, 2020
  154. Junio C HamanoNov 18, 2020
  155. Ævar Arnfjörð BjarmasonNov 18, 2020
  156. Felipe ContrerasNov 18, 2020
  157. Ævar Arnfjörð BjarmasonNov 20, 2020
  158. Felipe ContrerasNov 20, 2020
  159. Junio C HamanoNov 18, 2020
  160. Johannes SchindelinNov 19, 2020
  161. Junio C HamanoNov 19, 2020
  162. Johannes SchindelinNov 22, 2020
  163. Johannes SchindelinNov 19, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.