From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] status: really ignore config with --porcelain
Date: Thu, 27 Jun 2013 21:40:11 -0400 [thread overview]
Message-ID: <20130628014011.GA620@sigill.intra.peff.net> (raw)
In-Reply-To: <7vk3lj9xwn.fsf@alter.siamese.dyndns.org>
On Mon, Jun 24, 2013 at 11:16:56AM -0700, Junio C Hamano wrote:
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 0da944f..a535eb2 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -111,12 +111,14 @@ static int show_ignored_in_status;
> static const char *only_include_assumed;
> static struct strbuf message = STRBUF_INIT;
>
> -static enum {
> +static enum status_format {
> STATUS_FORMAT_NONE = 0,
> STATUS_FORMAT_LONG,
> STATUS_FORMAT_SHORT,
> - STATUS_FORMAT_PORCELAIN
> -} status_format;
> + STATUS_FORMAT_PORCELAIN,
> +
> + STATUS_FORMAT_UNSPECIFIED
> +} status_format = STATUS_FORMAT_UNSPECIFIED;
I'm not sure why you need to add UNSPECIFIED here; the point of NONE is
that no format had yet been specified.
It looks like the only difference is that finalize_deferred_config
converts unspecified into NONE. But I think you can just use NONE for
both cases, and drop this hunk:
> static int opt_parse_m(const struct option *opt, const char *arg, int unset)
> {
> @@ -457,6 +459,9 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
> case STATUS_FORMAT_PORCELAIN:
> wt_porcelain_print(s);
> break;
> + case STATUS_FORMAT_UNSPECIFIED:
> + die("BUG: finalize_deferred_config() should have been called");
> + break;
> case STATUS_FORMAT_NONE:
> case STATUS_FORMAT_LONG:
> wt_status_print(s);
You lose the assertion that finalize_deferred_config has been called,
but I think the resulting code would be simpler, as it drops this
die("BUG") state entirely. Am I missing something?
-Peff
next prev parent reply other threads:[~2013-06-28 1:40 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
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 [this message]
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=20130628014011.GA620@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).