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@xxxxxxxxxx> > --- > > 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)