Re: [PATCH v4] var: add GIT_DEFAULT_BRANCH variable

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

 



Thomas Weißschuh <thomas@xxxxxxxx> writes:

> Introduce the logical variable GIT_DEFAULT_BRANCH which represents the
> the default branch name that will be used by "git init".

Sorry for not realizing this earlier, but we are not reporting the
"default" with this feature.  If you have ~/.gitconfig with your
favourite configuration in it, what this reports is the name of the
branch created by "git init" without the "--initial-branch=<name>"
option.

So GIT_INITIAL_BRANCH_NAME might be a more appropriate name for the
variable from that realization.  But I do not feel too strongly
about it, so let's not keep rerolling but see what others think
first.

Thanks.  Will queue this version as-is.  The updated test looks good.

> +test_expect_success 'get GIT_DEFAULT_BRANCH without configuration' '
> +	(
> +		sane_unset GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME &&
> +		git init defbranch &&
> +		git -C defbranch symbolic-ref --short HEAD >expect &&
> +		git var GIT_DEFAULT_BRANCH >actual &&
> +		test_cmp expect actual
> +	)
> +'
> +
> +test_expect_success 'get GIT_DEFAULT_BRANCH with configuration' '
> +	test_config init.defaultbranch foo &&
> +	(
> +		sane_unset GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME &&
> +		echo foo >expect &&
> +		git var GIT_DEFAULT_BRANCH >actual &&
> +		test_cmp expect actual
> +	)
> +'
> +
>  # For git var -l, we check only a representative variable;
>  # testing the whole output would make our test too brittle with
>  # respect to unrelated changes in the test suite's environment.
>
> base-commit: 0cddd84c9f3e9c3d793ec93034ef679335f35e49




[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