git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: s_shestakov@playrix.com, kostix+git@007spb.ru,
	Matthieu.Moy@grenoble-inp.fr, tboegi@web.de, git@vger.kernel.org
Subject: Re: [PATCH] status: suppress additional warning output in plumbing modes
Date: Sat, 01 Jul 2017 15:52:05 +0200	[thread overview]
Message-ID: <87h8ywe03e.fsf@gmail.com> (raw)
In-Reply-To: <20170630162826.27711-1-sbeller@google.com>


On Fri, Jun 30 2017, Stefan Beller jotted:

> When status is called with '--porcelain' (as implied by '-z'), we promise
> to output only messages as described in the man page.
>
> Suppress CRLF warnings.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>
> Maybe something like this?

It looks sensibly implemented, but as for the approach I think we should
just document that you might get errors on stderr, but stable output on
stdout.

Many consumers of --porcelain, such as magit, will run arbitrary git
output and expect that if they get something on stderr they should be
showing it in some special buffer to the user as associated error
information.

I think it makes sense to do this & document it in the man page, if you
don't care about possible error messages 2>/dev/null is trivial, but
it's not trivial to discover in some non-expensive way (parsing the
non-porcelain output) that there *are* errors.

>  builtin/commit.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 00a01f07c3..3705d5ec6f 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1126,6 +1126,11 @@ static void finalize_deferred_config(struct wt_status *s)
>  			die(_("--long and -z are incompatible"));
>  	}
>
> +	/* suppress all additional output in porcelain mode */
> +	if (status_format == STATUS_FORMAT_PORCELAIN ||
> +	    status_format == STATUS_FORMAT_PORCELAIN_V2)
> +		safe_crlf = SAFE_CRLF_FALSE;
> +
>  	if (use_deferred_config && status_format == STATUS_FORMAT_UNSPECIFIED)
>  		status_format = status_deferred_config.status_format;
>  	if (status_format == STATUS_FORMAT_UNSPECIFIED)

  parent reply	other threads:[~2017-07-01 13:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  6:00 Bug with automated processing of git status results Сергей Шестаков
2017-06-30  7:12 ` Konstantin Khomoutov
2017-06-30  9:09 ` Matthieu Moy
2017-06-30  9:22   ` Torsten Bögershausen
2017-06-30 16:28     ` [PATCH] status: suppress additional warning output in plumbing modes Stefan Beller
2017-07-01 12:49       ` Torsten Bögershausen
2017-07-01 13:52       ` Ævar Arnfjörð Bjarmason [this message]
2017-07-01 17:35       ` Junio C Hamano
2017-07-05 18:53         ` Stefan Beller

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=87h8ywe03e.fsf@gmail.com \
    --to=avarab@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=kostix+git@007spb.ru \
    --cc=s_shestakov@playrix.com \
    --cc=sbeller@google.com \
    --cc=tboegi@web.de \
    /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).