Re: [PATCH 1/2] status: really ignore config with --porcelain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]