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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

>    by doing the following two.

A couple of test cases already have the `PREPARE_FOR_MAIN_BRANCH` prereq
(in preparation for transitioning the test suite, which is what I will
settle for in v2 of this patch series). Most notably, t5526 and t9902,
which I had to exclude to avoid clashing with branches that are currently
in flight.

So my goal is to transition the test suite as quickly as possible, by
first converting the majority in v2 of this patch series, and then
handling the rest of the test scripts individually, on top of the
in-flight topics.

>  - Use that mechanism to force 'main' in test scripts that now only
>    can work with 'main', even before we change the fallback default
>    from master to main in the production code, so that we won't lose
>    test coverage.

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

>  - The same for test scripts that are not converted yet to force use
>    of 'master', so that we could change the fallback default from
>    master to main in the production code even before converting
>    these other scripts, so that we won't lose test coverage.

Okay, I could have done it that way by starting with

	case "$TEST_NUMBER" in
	[01]*)
		GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
		export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
		;;
	*)
		GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
		export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
		;;
	esac

But that would result in a funny-looking intermediate state with a
`master` arm, then `main`, then again `master`.

Besides, it would be more complicated because t/t5411-proc-receive-hook.sh
and t/t5515-fetch-merge-logic.sh already ask for `main`, but by setting it
before sourcing `test-lib.sh`, and therefore we would have to special-case
them in that `case` from the get-go.

Therefore, in the interest of making this patch series _slightly_ easier
to review (you still have to look at the _bottom_ of most of those patches
to catch the crucial change to `t/test-lib.sh`), I would like to keep the
patch series in the current shape.

Will send v2 in a moment.

Thanks,
Dscho




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux