public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Ramkumar Ramachandra <artagnon@gmail•com>
Cc: Git List <git@vger•kernel.org>, Junio C Hamano <gitster@pobox•com>
Subject: Re: [PATCH 1/2] status: really ignore config with --porcelain
Date: Mon, 24 Jun 2013 15:51:16 +0200	[thread overview]
Message-ID: <vpqhagnwraj.fsf@anie.imag.fr> (raw)
In-Reply-To: <1372077912-18625-2-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Mon, 24 Jun 2013 18:15:11 +0530")

Ramkumar Ramachandra <artagnon@gmail•com> writes:

> Contrary to its description, the output of
>
>   $ git status --porcelain
>
> now depends on the configuration variables status.short and
> status.branch.

Ouch, indeed :-(.

> The correct solution is therefore to skip the config parser completely
> when --porcelain is given.  Unfortunately, to determine that --porcelain
> is given, we have to run the command-line option parser.  Running the
> command-line option parser before the config parser is undesirable, as
> configuration variables would override options on the command-line.  As
> a fair compromise, check that argv[1] is equal to the string
> "--porcelain" and skip the config parser in this case.

I really don't like this. If we go for a solution looking explicitely at
argv[], we should at least iterate over it (also not satisfactory
because --porcelain could be the argument of another switch).

I think it's possible to have an actually robust solution, either

* running the CLI parser after, if --porcelain is given, reset the
  effect of the variables. Not very clean because we'd have to reset all
  the variables to their default, and there is a risk of forgetting one.

* Or, running the CLI parser before, but with different variables to
  specify what the command-line says and what will actually be done,
  with something like

  actual_short = 0;
  switch (command_line_short) {
  case yes:
          actual_short = 1;
          break;
  case no:
          actual_short = 0;
          break;
  case unset: /* nothing */
  }
  switch (config_short) {
  // same
  }

> ---
>  builtin/commit.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

No time to contribute one now myself, but this would really deserve a
test.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2013-06-24 13:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 12:45 [PATCH (!) 0/2] Fix serious regressions in latest master Ramkumar Ramachandra
2013-06-24 12:45 ` [PATCH 1/2] status: really ignore config with --porcelain Ramkumar Ramachandra
2013-06-24 13:51   ` Matthieu Moy [this message]
2013-06-24 14:05     ` Ramkumar Ramachandra
2013-06-24 14:51       ` Matthieu Moy
2013-06-24 16:35         ` Junio C Hamano
2013-06-24 16:50           ` Matthieu Moy
2013-06-24 17:16             ` Junio C Hamano
2013-06-24 17:21               ` Matthieu Moy
2013-06-24 18:16             ` Junio C Hamano
2013-06-24 19:30               ` Ramkumar Ramachandra
2013-06-24 22:24                 ` Junio C Hamano
2013-06-24 19:49               ` Junio C Hamano
2013-06-28  1:40               ` Jeff King
2013-06-28  3:59                 ` Junio C Hamano
2013-06-28 17:37                   ` Junio C Hamano
2013-06-28 19:31                     ` Jeff King
2013-06-28 20:15                       ` Junio C Hamano
2013-06-24 16:53           ` Ramkumar Ramachandra
2013-06-24 14:55     ` Junio C Hamano
2013-06-24 15:04       ` Matthieu Moy
2013-06-24 15:50       ` Ramkumar Ramachandra
2013-06-24 12:45 ` [PATCH 2/2] commit: make it work with status.short Ramkumar Ramachandra
2013-06-24 15:17   ` Junio C Hamano
2013-06-24 15:39     ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqhagnwraj.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=artagnon@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox