Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > Hi Junio, > > On Mon, 16 Nov 2020, Junio C Hamano wrote: > >> Junio C Hamano <gitster@xxxxxxxxx> writes: >> >> > Some test scripts may require setting init.defaultBranch='master' >> > at the top in the 'setup' part (I've shown how in my response to >> > t4013 patchset) if the body of the test relies too heavily on the >> > primary branch to be 'master'. >> >> Ah, I realized we have much better mechanism already in the form of >> GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME environment. >> >> So, my three wishes in this message now become >> >> - lose PREPARE_FOR_MAIN_BRANCH prerequisite as quickly as possible > > Okay, we're on the same page here. Yeah, you may have noticed after reading my recent messages to this topic, my initial reaction was mostly triggered by "eh, are we losing test coverage too much?" before re-reading what the patches (both what we have already merged and these 28 final stretch patches) actually do, and realizing that they aim at preparing us so that we can flip the fallback default any time we like. So we are very much on the same page. > That's precisely what I do, incrementally, by adjusting that `case` > statement in `t/test-lib.sh` whenever a range of test scripts has been > transitioned. In patch 2/28, it looks like this: > > case "$TEST_NUMBER" in > [01]*) > GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main > export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME > ;; > esac > > By patch 26/28, it looks like this: > > case "$TEST_NUMBER" in > 3404|4013|5310|5526|6300|7064|7817|9902) > # Avoid conflicts with patch series that are cooking at the same > # time > # as the patch series changing the default of > # `init.defaultBranch`. > GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master > export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME > ;; > *) > GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main > export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME > ;; > esac I actually am not a big fan of the centralized table of "these want to run with main". My ideal would be to have an explicit assignment of either master or main for tests that absolutely require the default to be one of these names at the top of these script, and any test scripts that do not care what the initial branch is called (perhaps because they begin by switching to a branch whose name is picked by them immediately after they start and use that name throughout) won't have GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME in them. I think we can live with a centralized "case", but I have trouble with seeing only two arms in the above case statement, whether which one gets the asterisk. There may be ones that need to force 'master', there may be ones that need to force 'main', but hopefully many do not even have to force and can work with either. And seeing "everything else works only with 'main'" is a bit disappointing. But if you must have a case with only two arms, i.e. "these are exceptions" and "everything else", I think the above (i.e. we refrain from touching these and force them to 'master' as exceptions, but everything else is forced to 'main') is better than having them the other way around. Thanks.