Thread (41 messages) flat view 41 messages, 8 authors, 2016-06-15
STALE3734d

[PATCH 2/7] http-push: allow stderr messages to appear alongside helper_status ones

From: Tay Ray Chuan <hidden>
Date: 2016-06-15 22:47:36
Subsystem: the rest · Maintainer: Linus Torvalds

These messages notifies user over pushing progress (or the lack
thereof). It is safe for them to appear alongside status reports
('ok|error <dst>'), since the reports go to stdout, while the
notifications go to stderr.

Signed-off-by: Tay Ray Chuan <redacted>
---
 http-push.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/http-push.c b/http-push.c
index 24eec73..b97ea1f 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1946,10 +1946,9 @@ int main(int argc, char **argv)

 		if (is_null_sha1(ref->peer_ref->new_sha1)) {
 			if (delete_remote_branch(ref->name, 1) == -1) {
+				error("Could not remove %s", ref->name);
 				if (helper_status)
 					printf("error %s cannot remove\n", ref->name);
-				else
-					error("Could not remove %s", ref->name);
 				rc = -4;
 			}
 			else if (helper_status)
@@ -1980,15 +1979,14 @@ int main(int argc, char **argv)
 				 * commits at the remote end and likely
 				 * we were not up to date to begin with.
 				 */
+				error("remote '%s' is not an ancestor of\n"
+				      "local '%s'.\n"
+				      "Maybe you are not up-to-date and "
+				      "need to pull first?",
+				      ref->name,
+				      ref->peer_ref->name);
 				if (helper_status)
 					printf("error %s non-fast forward\n", ref->name);
-				else
-					error("remote '%s' is not an ancestor of\n"
-						  "local '%s'.\n"
-						  "Maybe you are not up-to-date and "
-						  "need to pull first?",
-						  ref->name,
-						  ref->peer_ref->name);
 				rc = -2;
 				continue;
 			}
@@ -2011,11 +2009,10 @@ int main(int argc, char **argv)
 		/* Lock remote branch ref */
 		ref_lock = lock_remote(ref->name, LOCK_TIME);
 		if (ref_lock == NULL) {
+			fprintf(stderr, "Unable to lock remote branch %s\n",
+				ref->name);
 			if (helper_status)
 				printf("error %s lock error\n", ref->name);
-			else
-				fprintf(stderr, "Unable to lock remote branch %s\n",
-					ref->name);
 			rc = 1;
 			continue;
 		}
--
1.6.4.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help