git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Warn when send-pack does nothing

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Dec 4, 2005, 16:59 UTC
Message-ID
<Pine.LNX.4.64.0512041141280.25300@iabervon.org>

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 <barkalow@iabervon.org>
---
 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
Message 1 of 1 in “Warn when send-pack does nothing”
  1. Warn when send-pack does nothingDaniel Barkalow, Dec 4, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.