提交 ec85d070 编写于 作者: J Jorge Juan Garcia Garcia 提交者: Junio C Hamano

status: introduce status.branch to enable --branch by default

Some people often run 'git status -b'.
The config variable status.branch allows to set it by default.
Signed-off-by: NJorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>
Signed-off-by: NMathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>
Reviewed-by: NMatthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: NMatthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 4fb5166a
......@@ -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
......
......@@ -1117,6 +1117,10 @@ static int git_status_config(const char *k, const char *v, void *cb)
status_format = STATUS_FORMAT_NONE;
return 0;
}
if (!strcmp(k, "status.branch")) {
s->show_branch = git_config_bool(k, v);
return 0;
}
if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
s->use_color = git_config_colorbool(k, v);
return 0;
......
......@@ -1361,6 +1361,33 @@ test_expect_success '"status.short=false" weaker than "-s"' '
test_cmp expected_short actual
'
test_expect_success '"status.branch=true" same as "-b"' '
git status -sb >expected_branch &&
git -c status.branch=true status -s >actual &&
test_cmp expected_branch actual
'
test_expect_success '"status.branch=true" different from "--no-branch"' '
git status -s --no-branch >expected_nobranch &&
git -c status.branch=true status -s >actual &&
test_must_fail test_cmp expected_nobranch actual
'
test_expect_success '"status.branch=true" weaker than "--no-branch"' '
git -c status.branch=true status -s --no-branch >actual &&
test_cmp expected_nobranch actual
'
test_expect_success '"status.branch=false" same as "--no-branch"' '
git -c status.branch=false status -s >actual &&
test_cmp expected_nobranch actual
'
test_expect_success '"status.branch=false" weaker than "-b"' '
git -c status.branch=false status -sb >actual &&
test_cmp expected_branch actual
'
test_expect_success 'Restore default test environment' '
git config --unset status.showUntrackedFiles
'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册