{"thread":{"id":"34064","subject":"[PATCH 2/2] status: introduce status.branch to enable --branch by default","startedAt":"2013-06-08T09:28:56Z","lastAt":"2013-06-10T08:02:39Z","messageCount":7,"participants":["Jorge Juan Garcia Garcia","Ramkumar Ramachandra","Junio C Hamano","Matthieu Moy","garciagj"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"219792","messageId":"1370683737-28823-1-git-send-email-Jorge-Juan.Garcia-Garcia@ensimag.imag.fr","threadId":"34064","inReplyTo":null,"subject":"[PATCH 1/2] status: introduce status.short to enable --short by default","fromName":"Jorge Juan Garcia Garcia","fromEmail":"jorge-juan.garcia-garcia@ensimag.imag.fr","sentAt":"2013-06-08T09:28:56Z","receivedAt":"2013-06-08T09:28:56Z","isPatch":true,"sender":{"key":"jorge-juan.garcia-garcia@ensimag.imag.fr","avatar":null},"body":"Some people always run 'git status -s'.\nThe configuration variable status.short allows to set it by default.\n\nSigned-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>\nSigned-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\n Documentation/config.txt |    3 +++\n builtin/commit.c         |    9 +++++++++\n config.c                 |    1 +\n t/t7508-status.sh        |   34 ++++++++++++++++++++++++++++++++++\n 4 files changed, 47 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 6e53fc5..80cdf75 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2066,6 +2066,9 @@ status.relativePaths::\n \trelative to the repository root (this was the default for Git\n \tprior to v1.5.4).\n \n+status.short::\n+\tSet to true to enable --short by default in linkgit:git-status[1].\n+\n status.showUntrackedFiles::\n \tBy default, linkgit:git-status[1] and linkgit:git-commit[1] show\n \tfiles which are not currently tracked by Git. Directories which\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 1621dfc..0f3429f 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1112,6 +1112,15 @@ static int git_status_config(const char *k, const char *v, void *cb)\n \t\t\ts->submodule_summary = -1;\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"status.short\")) {\n+\t\tif (!v)\n+\t\t\treturn config_error_nonbool(k);\n+\t\tif (git_config_bool(k,v)) {\n+\t\t\tstatus_format = STATUS_FORMAT_SHORT;\n+\t\t\twt_shortstatus_print(s);\n+\t\t}\n+\t\treturn 0;\n+\t}\n \tif (!strcmp(k, \"status.color\") || !strcmp(k, \"color.status\")) {\n \t\ts->use_color = git_config_colorbool(k, v);\n \t\treturn 0;\ndiff --git a/config.c b/config.c\nindex 7a85ebd..85ddbf2 100644\n--- a/config.c\n+++ b/config.c\n@@ -9,6 +9,7 @@\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\n #include \"quote.h\"\n+#include \"commit.h\"\n \n typedef struct config_file {\n \tstruct config_file *prev;\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex e2ffdac..4cb2b62 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -1334,5 +1334,39 @@ test_expect_failure '.git/config ignore=all suppresses submodule summary' '\n \tgit config --remove-section submodule.subname &&\n \tgit config -f .gitmodules  --remove-section submodule.subname\n '\n+test_expect_success 'setup for testing status.short' '\n+    >status1 &&\n+    >status2\n+'\n+\n+test_expect_success '\"status.short=true\" same as \"-s\"' '\n+    git -c status.short=true status >status2 &&\n+    git status -s >status1 &&\n+    test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.short=true\" different from \"--no-short\"' '\n+    git -c status.short=true status >status2 &&\n+    git status --no-short >status1 &&\n+    test_must_fail test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.short=true\" weaker than \"--no-short\"' '\n+    git -c status.short=true status --no-short >status2 &&\n+    git status --no-short >status1 &&\n+    test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.short=false\" same as \"--no-short\"' '\n+    git -c status.short=false status >status2 &&\n+    git status --no-short >status1 &&\n+    test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.short=false\" weaker than \"-s\"' '\n+    git -c status.short=false status -s >status2 &&\n+    git status -s >status1 &&\n+    test_cmp status1 status2\n+'\n \n test_done\n-- \n1.7.8\n"},{"id":"219791","messageId":"1370683737-28823-2-git-send-email-Jorge-Juan.Garcia-Garcia@ensimag.imag.fr","threadId":"34064","inReplyTo":"1370683737-28823-1-git-send-email-Jorge-Juan.Garcia-Garcia@ensimag.imag.fr","subject":"[PATCH 2/2] status: introduce status.branch to enable --branch by default","fromName":"Jorge Juan Garcia Garcia","fromEmail":"jorge-juan.garcia-garcia@ensimag.imag.fr","sentAt":"2013-06-08T09:28:57Z","receivedAt":"2013-06-08T09:28:57Z","isPatch":true,"sender":{"key":"jorge-juan.garcia-garcia@ensimag.imag.fr","avatar":null},"body":"Some people often run 'git status -b'.\nThe config variable status.branch allows to set it by default.\n\nSigned-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>\nSigned-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\n---\n Documentation/config.txt |    3 +++\n builtin/commit.c         |    6 ++++++\n t/t7508-status.sh        |   30 ++++++++++++++++++++++++++++++\n 3 files changed, 39 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 80cdf75..21ba9c2 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2069,6 +2069,9 @@ status.relativePaths::\n status.short::\n \tSet to true to enable --short by default in linkgit:git-status[1].\n \n+status.branch::\n+\tSet to true to enable --branch by default in linkgit:git-status[1].\n+\n status.showUntrackedFiles::\n \tBy default, linkgit:git-status[1] and linkgit:git-commit[1] show\n \tfiles which are not currently tracked by Git. Directories which\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 0f3429f..d447857 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1121,6 +1121,12 @@ static int git_status_config(const char *k, const char *v, void *cb)\n \t\t}\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"status.branch\")) {\n+\t\tif (!v)\n+\t\t\treturn config_error_nonbool(k);\n+\t\ts->show_branch = git_config_bool(k,v);\n+\t\treturn 0;\n+\t}\n \tif (!strcmp(k, \"status.color\") || !strcmp(k, \"color.status\")) {\n \t\ts->use_color = git_config_colorbool(k, v);\n \t\treturn 0;\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 4cb2b62..34cf30f 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -1369,4 +1369,34 @@ test_expect_success '\"status.short=false\" weaker than \"-s\"' '\n     test_cmp status1 status2\n '\n \n+test_expect_success '\"status.branch=true\" same as \"-b\"' '\n+    git -c status.branch=true status -s >status2 &&\n+    git status -sb >status1 &&\n+    test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.branch=true\" different from \"--no-branch\"' '\n+    git -c status.branch=true status -s >status2 &&\n+    git status -s --no-branch  >status1 &&\n+    test_must_fail test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.branch=true\" weaker than \"--no-branch\"' '\n+    git -c status.branch=true status -s --no-branch >status2 &&\n+    git status -s --no-branch >status1 &&\n+    test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.branch=false\" same as \"--no-branch\"' '\n+    git -c status.branch=false status -s >status2 &&\n+    git status -s --no-branch >status1 &&\n+    test_cmp status1 status2\n+'\n+\n+test_expect_success '\"status.branch=false\" weaker than \"-b\"' '\n+    git -c status.branch=false status -sb >status2 &&\n+    git status -sb >status1 &&\n+    test_cmp status1 status2\n+'\n+\n test_done\n-- \n1.7.8\n"},{"id":"219832","messageId":"CALkWK0kvKzFoZmz313hR-3Z71y-MDPT37BfUi7Qrgy7hz_sErQ@mail.gmail.com","threadId":"34064","inReplyTo":"1370683737-28823-1-git-send-email-Jorge-Juan.Garcia-Garcia@ensimag.imag.fr","subject":"Re: [PATCH 1/2] status: introduce status.short to enable --short by default","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-08T15:25:19Z","receivedAt":"2013-06-08T15:25:19Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Jorge Juan Garcia Garcia wrote:\n> Some people always run 'git status -s'.\n> The configuration variable status.short allows to set it by default.\n\nGood feature.\n\n> @@ -1112,6 +1112,15 @@ static int git_status_config(const char *k, const char *v, void *cb)\n>                         s->submodule_summary = -1;\n>                 return 0;\n>         }\n> +       if (!strcmp(k, \"status.short\")) {\n> +               if (!v)\n> +                       return config_error_nonbool(k);\n> +               if (git_config_bool(k,v)) {\n> +                       status_format = STATUS_FORMAT_SHORT;\n> +                       wt_shortstatus_print(s);\n> +               }\n> +               return 0;\n> +       }\n\nIncorrect.  This is the wrong place to use config_error_nonbool():\nthis is very much a bool, and a \"[status] short\" in ~/.gitconfig\nshould not error out (all boolean variables behave in the same\nmanner).  When in doubt, consult config_error_nonbool(); there's\nclearly a comment stating:\n\n/*\n * Call this to report error for your variable that should not\n * get a boolean value (i.e. \"[my] var\" means \"true\").\n */\n\nAlso, why are you calling wt_shortstatus_print() here, instead of\nreturning control to cmd_status(), which is going to do it anyway?\n"},{"id":"220097","messageId":"7v4nd7qflu.fsf@alter.siamese.dyndns.org","threadId":"34064","inReplyTo":"CALkWK0kvKzFoZmz313hR-3Z71y-MDPT37BfUi7Qrgy7hz_sErQ@mail.gmail.com","subject":"Re: [PATCH 1/2] status: introduce status.short to enable --short by default","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-09T18:54:53Z","receivedAt":"2013-06-09T18:54:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> Jorge Juan Garcia Garcia wrote:\n>> Some people always run 'git status -s'.\n>> The configuration variable status.short allows to set it by default.\n>\n> Good feature.\n\nIs there a corresponding command line override added to help people\nwho need to defeat such a configured-in default?  Otherwise it is\nnot a good feature yet, but just only the beginning half.\n"},{"id":"220110","messageId":"vpqbo7frspc.fsf@anie.imag.fr","threadId":"34064","inReplyTo":"7v4nd7qflu.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] status: introduce status.short to enable --short by default","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-06-09T19:26:39Z","receivedAt":"2013-06-09T19:26:39Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Ramkumar Ramachandra <artagnon@gmail.com> writes:\n>\n>> Jorge Juan Garcia Garcia wrote:\n>>> Some people always run 'git status -s'.\n>>> The configuration variable status.short allows to set it by default.\n>>\n>> Good feature.\n>\n> Is there a corresponding command line override added to help people\n> who need to defeat such a configured-in default?\n\nYes: \"git status --no-short\".\n\nPerhaps the doc for status.short should explicitely mention that\n--no-short takes precedence over it.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"220255","messageId":"3774bdd37ba5b330143d5a2b675955dc@ensibm.imag.fr","threadId":"34064","inReplyTo":"CALkWK0kvKzFoZmz313hR-3Z71y-MDPT37BfUi7Qrgy7hz_sErQ@mail.gmail.com","subject":"Re: [PATCH 1/2] status: introduce status.short to enable --short by default","fromName":"garciagj","fromEmail":"garciagj@ensibm.imag.fr","sentAt":"2013-06-10T08:01:34Z","receivedAt":"2013-06-10T08:01:34Z","isPatch":true,"sender":{"key":"garciagj@ensibm.imag.fr","avatar":null},"body":"El 2013-06-08 17:25, Ramkumar Ramachandra escribió:\n> Jorge Juan Garcia Garcia wrote:\n>> Some people always run 'git status -s'.\n>> The configuration variable status.short allows to set it by default.\n>\n> Good feature.\n>\n>> @@ -1112,6 +1112,15 @@ static int git_status_config(const char *k, \n>> const char *v, void *cb)\n>>                         s->submodule_summary = -1;\n>>                 return 0;\n>>         }\n>> +       if (!strcmp(k, \"status.short\")) {\n>> +               if (!v)\n>> +                       return config_error_nonbool(k);\n>> +               if (git_config_bool(k,v)) {\n>> +                       status_format = STATUS_FORMAT_SHORT;\n>> +                       wt_shortstatus_print(s);\n>> +               }\n>> +               return 0;\n>> +       }\n>\n> Incorrect.  This is the wrong place to use config_error_nonbool():\n> this is very much a bool, and a \"[status] short\" in ~/.gitconfig\n> should not error out (all boolean variables behave in the same\n> manner).  When in doubt, consult config_error_nonbool(); there's\n> clearly a comment stating:\n\nOk. We will change it.\n\n>\n> /*\n>  * Call this to report error for your variable that should not\n>  * get a boolean value (i.e. \"[my] var\" means \"true\").\n>  */\n>\n> Also, why are you calling wt_shortstatus_print() here, instead of\n> returning control to cmd_status(), which is going to do it anyway?\nYes, it's obviously a mistake.\n"},{"id":"220256","messageId":"9646ae430a3789ab2a7a968b337f0a8c@ensibm.imag.fr","threadId":"34064","inReplyTo":"vpqbo7frspc.fsf@anie.imag.fr","subject":"Re: [PATCH 1/2] status: introduce status.short to enable --short by default","fromName":"garciagj","fromEmail":"garciagj@ensibm.imag.fr","sentAt":"2013-06-10T08:02:39Z","receivedAt":"2013-06-10T08:02:39Z","isPatch":true,"sender":{"key":"garciagj@ensibm.imag.fr","avatar":null},"body":"El 2013-06-09 21:26, Matthieu Moy escribió:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Ramkumar Ramachandra <artagnon@gmail.com> writes:\n>>\n>>> Jorge Juan Garcia Garcia wrote:\n>>>> Some people always run 'git status -s'.\n>>>> The configuration variable status.short allows to set it by \n>>>> default.\n>>>\n>>> Good feature.\n>>\n>> Is there a corresponding command line override added to help people\n>> who need to defeat such a configured-in default?\n>\n> Yes: \"git status --no-short\".\n>\n> Perhaps the doc for status.short should explicitely mention that\n> --no-short takes precedence over it.\n\n\nYes, I will include that in the Documentation.\n"}]}