Re: [PATCH 1/2] status: introduce status.short to enable --short by default
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jun 8, 2013, 15:25 UTC
- Message-ID
- <CALkWK0kvKzFoZmz313hR-3Z71y-MDPT37BfUi7Qrgy7hz_sErQ@mail.gmail.com>
- In-Reply-To
- <1370683737-28823-1-git-send-email-Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>
Jorge Juan Garcia Garcia wrote:
> Some people always run 'git status -s'. > The configuration variable status.short allows to set it by default.
Good feature.
Show 13 quoted lines
> @@ -1112,6 +1112,15 @@ static int git_status_config(const char *k, const char *v, void *cb)
> s->submodule_summary = -1;
> return 0;
> }
> + if (!strcmp(k, "status.short")) {
> + if (!v)
> + return config_error_nonbool(k);
> + if (git_config_bool(k,v)) {
> + status_format = STATUS_FORMAT_SHORT;
> + wt_shortstatus_print(s);
> + }
> + return 0;
> + }Incorrect. This is the wrong place to use config_error_nonbool(): this is very much a bool, and a "[status] short" in ~/.gitconfig should not error out (all boolean variables behave in the same manner). When in doubt, consult config_error_nonbool(); there's clearly a comment stating:
/* * Call this to report error for your variable that should not * get a boolean value (i.e. "[my] var" means "true"). */
Also, why are you calling wt_shortstatus_print() here, instead of returning control to cmd_status(), which is going to do it anyway?