Thread (23 messages) flat view 23 messages, 5 authors, 2016-06-15
STALE3730d

[PATCH 2/3] silence human readable info messages going to stderr from git push --porcelain

From: Larry D'Anna <hidden>
Date: 2016-06-15 22:48:11
Subsystem: the rest · Maintainer: Linus Torvalds

These messages are redundant information to a script that's calling git-push.

Signed-off-by: Larry D'Anna <redacted>
---
 builtin-push.c |    4 ++--
 transport.c    |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin-push.c b/builtin-push.c
index 0a27072..3fa4516 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -111,7 +111,7 @@ static int push_with_options(struct transport *transport, int flags)
 	if (thin)
 		transport_set_option(transport, TRANS_OPT_THIN, "yes");
 
-	if (flags & TRANSPORT_PUSH_VERBOSE)
+	if (flags & TRANSPORT_PUSH_VERBOSE && !(flags & TRANSPORT_PUSH_PORCELAIN))
 		fprintf(stderr, "Pushing to %s\n", transport->url);
 	err = transport_push(transport, refspec_nr, refspec, flags,
 			     &nonfastforward);
@@ -123,7 +123,7 @@ static int push_with_options(struct transport *transport, int flags)
 	if (!err)
 		return 0;
 
-	if (nonfastforward && advice_push_nonfastforward) {
+	if (!(flags & TRANSPORT_PUSH_PORCELAIN) && nonfastforward && advice_push_nonfastforward) {
 		fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n"
 				"Merge the remote changes before pushing again.  See the 'Note about\n"
 				"fast-forwards' section of 'git push --help' for details.\n");
diff --git a/transport.c b/transport.c
index 3846aac..f707c7b 100644
--- a/transport.c
+++ b/transport.c
@@ -674,7 +674,7 @@ static void print_ok_ref_status(struct ref *ref, int porcelain)
 
 static int print_one_push_status(struct ref *ref, const char *dest, int count, int porcelain)
 {
-	if (!count)
+	if (!count && !porcelain)
 		fprintf(stderr, "To %s\n", dest);
 
 	switch(ref->status) {
@@ -1067,10 +1067,10 @@ int transport_push(struct transport *transport,
 		if (!(flags & TRANSPORT_PUSH_DRY_RUN)) {
 			struct ref *ref;
 			for (ref = remote_refs; ref; ref = ref->next)
-				update_tracking_ref(transport->remote, ref, verbose);
+				update_tracking_ref(transport->remote, ref, verbose && !porcelain);
 		}
 
-		if (!quiet && !ret && !refs_pushed(remote_refs))
+		if (!quiet && !porcelain && !ret && !refs_pushed(remote_refs))
 			fprintf(stderr, "Everything up-to-date\n");
 		return ret;
 	}
-- 
1.7.0.rc1.33.g07cf0f.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help