Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: [PATCH v3 2/3] git-push: clean up some of the output from git push --porcelain

From: Jeff King <hidden>
Date: 2016-06-15 22:48:13

On Mon, Feb 08, 2010 at 02:59:01PM -0800, Junio C Hamano wrote:
quoted
quoted
+	if (flags & TRANSPORT_PUSH_PORCELAIN) {
+		/* Do not give advice messages to Porcelain scripts */
+		advice_push_nonfastforward = 0;
+	}
I think this is sane.
I am tempted to suggest adding "clear_advice(void)" in advice.[ch], so
that people adding new advices do not have to hunt for even the above
hunk.  It would be a good direction to go in general _if_ we will have
more like this --porcelain thing in other parts of the system.

I didn't do so because that "_if_" is still iffy.
Would it make sense to clear _all_ advice if we are just in porcelain
mode for git-push? That is, let's say I am in "push --porcelain" and I
try to write a reflog entry for a local tracking ref, but my identity is
implicitly picked up from the hostname[1]. Should it trigger
advice_implicit_identity and say "by the way, your identity is implicit"
on stderr or not?

I would say yes. The advice output should all be on stderr, and the
porcelain output should all be on stdout. So there is no parsing
conflict. And stderr either goes to /dev/null (because the porcelain is
not terminal-based, or doesn't want the terminal screwed up), in which
case the advice does nothing, or stderr goes to the terminal (because
the porcelain is some simple script), in which case the message is
probably something the user would want to see.

-Peff

[1] I am actually not sure if you can trigger the implicit identity
advice in this way. But I am arguing from the perspective of "assume you
have triggered some random advice through some sub-action", which may
include advice to be added in the future.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help