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

[PATCH] git fetch-pack: do not complain about "no common commits" in an empty repo

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 2, 2008, 17:06 UTC
Message-ID
<alpine.DEB.1.00.0807021806250.9925@racer>

If the repo is empty, it is obvious that there are no common commits when fetching from _anywhere_.

So there is no use in saying it in that case, and it can even be annoying. Therefore suppress the message unilaterally if the repository is empty prior to the fetch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	This patch was originally developed in the 4msysgit branch.
 builtin-fetch-pack.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index f4dbcf0..2175c6d 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -309,7 +309,8 @@ done:
 		}
 		flushes--;
 	}
-	return retval;
+	/* it is no error to fetch into a completely empty repo */
+	return count ? retval : 0;
 }
 
 static struct commit_list *complete;
-- 
1.5.6.1.300.gca3f
Message 1 of 1 in “git fetch-pack: do not complain about "no common commits" in an empty repo”
  1. git fetch-pack: do not complain about "no common commits" in an empty repoJohannes Schindelin, Jul 2, 2008

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.