Re: [PATCH v3 2/2] status:introduce status.branch to enable --branch by default

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

 



Jorge Juan Garcia Garcia  <Jorge-Juan.Garcia-Garcia@xxxxxxxxxxxxxxx>
writes:

> Some people often run 'git status -b'.
> The config variable status.branch allows to set it by default.
>
> Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@xxxxxxxxxxxxxxx>
> Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@xxxxxxxxxxxxxxx>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx>
> ---
>
> Changes since v2:
>  -removal of double quotes in test
>
>  Documentation/config.txt |    4 ++++
>  builtin/commit.c         |    4 ++++
>  t/t7508-status.sh        |   27 +++++++++++++++++++++++++++
>  3 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 1983bf7..ecdcd6d 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -2070,6 +2070,10 @@ status.short::
>  	Set to true to enable --short by default in linkgit:git-status[1].
>  	The option --no-short takes precedence over this variable.
>  
> +status.branch::
> +	Set to true to enable --branch by default in linkgit:git-status[1].
> +	The option --no-branch takes precedence over this variable.
> +
>  status.showUntrackedFiles::
>  	By default, linkgit:git-status[1] and linkgit:git-commit[1] show
>  	files which are not currently tracked by Git. Directories which
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 287f1cb..f2b5d44 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1117,6 +1117,10 @@ static int git_status_config(const char *k, const char *v, void *cb)
>  			status_format = STATUS_FORMAT_SHORT;
>  		return 0;
>  	}
> +	if (!strcmp(k, "status.branch")) {
> +		s->show_branch = git_config_bool(k, v);

This one, unlike 1/2, acts correctly when status.branch is set to
no.  Good.

The same comments as 1/2 apply to the test script additions in this
patch.

> +		return 0;
> +	}
>  	if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
>  		s->use_color = git_config_colorbool(k, v);
>  		return 0;
> diff --git a/t/t7508-status.sh b/t/t7508-status.sh
> index d99ca9f..5e6df95 100755
> --- a/t/t7508-status.sh
> +++ b/t/t7508-status.sh
> @@ -1366,6 +1366,33 @@ test_expect_success '"status.short=false" weaker than "-s"' '
>  	test_cmp actual expected_short
>  '
>  
> +test_expect_success '"status.branch=true" same as "-b"' '
> +	git -c status.branch=true status -s >actual &&
> +	git status -sb >expected_branch &&
> +	test_cmp actual expected_branch
> +'
> +
> +test_expect_success '"status.branch=true" different from "--no-branch"' '
> +	git -c status.branch=true status -s >actual &&
> +	git status -s --no-branch  >expected_nobranch &&
> +	test_must_fail test_cmp actual expected_nobranch
> +'
> +
> +test_expect_success '"status.branch=true" weaker than "--no-branch"' '
> +	git -c status.branch=true status -s --no-branch >actual &&
> +	test_cmp actual expected_nobranch
> +'
> +
> +test_expect_success '"status.branch=false" same as "--no-branch"' '
> +	git -c status.branch=false status -s >actual &&
> +	test_cmp actual expected_nobranch
> +'
> +
> +test_expect_success '"status.branch=false" weaker than "-b"' '
> +	git -c status.branch=false status -sb >actual &&
> +	test_cmp actual expected_branch
> +'
> +
>  test_expect_success 'Restore default test environment' '
>  	git config --unset status.showUntrackedFiles
>  '
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]