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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <rctay89@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]