DORMANTno replies

[PATCH] Warn when send-pack does nothing

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:42:14
Subsystem: the rest · Maintainer: Linus Torvalds

If you try to push into an empty repository with no ref arguments to
git push, it doesn't do anything and doesn't say anything. This adds a
warning when send-pack isn't going to push anything, so you don't
assume that it silently did what you wanted.

Signed-off-by: Daniel Barkalow <redacted>

---

 send-pack.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

applies-to: fe523a4df93cce3e5c5b0266b9d3f1cbea009afa
5519af6444d6da0ac55343fe48fe7f68fdb593d9
diff --git a/send-pack.c b/send-pack.c
index 3eeb18f..589e1f9 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -190,6 +190,12 @@ static int send_pack(int in, int out, in
 	if (match_refs(local_refs, remote_refs, &remote_tail,
 		       nr_refspec, refspec, send_all))
 		return -1;
+
+	if (!remote_refs) {
+		fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
+		return 0;
+	}
+
 	/*
 	 * Finally, tell the other end!
 	 */
---
0.99.9.GIT
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help