status: introduce status.short to enable --short by default
Some people always run 'git status -s'. The configuration variable status.short allows to set it by default. Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr> Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr> Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jorge Juan Garcia Garcia committed
Jun 11, 2013 at 15:34 UTC
50e4f757f4adda096239c1ad60499cf606bf2c6f
3 files changed
+41
Documentation/config.txt
+4
@@ -2066,6 +2066,10 @@ status.relativePaths::
2066
relative to the repository root (this was the default for Git
2067
prior to v1.5.4).
2068
2069
+status.short::
2070
+ Set to true to enable --short by default in linkgit:git-status[1].
2071
+ The option --no-short takes precedence over this variable.
2072
+
2073
status.showUntrackedFiles::
2074
By default, linkgit:git-status[1] and linkgit:git-commit[1] show
2075
files which are not currently tracked by Git. Directories which
builtin/commit.c
+7
@@ -1110,6 +1110,13 @@ static int git_status_config(const char *k, const char *v, void *cb)
1110
s->submodule_summary = -1;
1111
return 0;
1112
}
1113
+ if (!strcmp(k, "status.short")) {
1114
+ if (git_config_bool(k, v))
1115
+ status_format = STATUS_FORMAT_SHORT;
1116
+ else
1117
+ status_format = STATUS_FORMAT_NONE;
1118
+ return 0;
1119
+ }
1120
if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
1121
s->use_color = git_config_colorbool(k, v);
1122
return 0;
t/t7508-status.sh
+30
@@ -1335,4 +1335,34 @@ test_expect_failure '.git/config ignore=all suppresses submodule summary' '
1335
git config -f .gitmodules --remove-section submodule.subname
1336
'
1337
1338
+test_expect_success 'setup of test environment' '
1339
+ git config status.showUntrackedFiles no &&
1340
+ git status -s >expected_short &&
1341
+ git status --no-short >expected_noshort
1342
+'
1343
+
1344
+test_expect_success '"status.short=true" same as "-s"' '
1345
+ git -c status.short=true status >actual &&
1346
+ test_cmp expected_short actual
1347
+'
1348
+
1349
+test_expect_success '"status.short=true" weaker than "--no-short"' '
1350
+ git -c status.short=true status --no-short >actual &&
1351
+ test_cmp expected_noshort actual
1352
+'
1353
+
1354
+test_expect_success '"status.short=false" same as "--no-short"' '
1355
+ git -c status.short=false status >actual &&
1356
+ test_cmp expected_noshort actual
1357
+'
1358
+
1359
+test_expect_success '"status.short=false" weaker than "-s"' '
1360
+ git -c status.short=false status -s >actual &&
1361
+ test_cmp expected_short actual
1362
+'
1363
+
1364
+test_expect_success 'Restore default test environment' '
1365
+ git config --unset status.showUntrackedFiles
1366
+'
1367
+
1368
test_done