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

Re: git fetch origin hanging in 1.7.0

From
Jeff King <peff@peff.net>
Date
Feb 16, 2010, 06:39 UTC
Message-ID
<20100216063959.GC2169@coredump.intra.peff.net>
In-Reply-To
<7e3605161002151608t44bd320cgcd589796a9ec902b@mail.gmail.com>
On Mon, Feb 15, 2010 at 07:08:25PM -0500, Kevin Menard wrote:
Show 9 quoted lines
> I've run into an issue that doing a "git fetch origin" is hanging for
> me in git 1.7.0.  The setup here may be wrong, so I don't want to call
> it a bug.  But basically I have an empty repo created on the server
> that a client then clones.  There's a job that fetches new updates to
> the server periodically.  If nothing has been pushed to the server
> yet, the client fetch hangs.
> 
> This worked fine in 1.6.6, so I'll just roll back my version for now.
> But any help on how to do this different would be much appreciated.

No, what you're doing should work OK (though it does actually produce ugly "the remote end hung up unexpectedly" messages in v1.6.6).

I can reproduce the bug with:
  $ mkdir foo && (cd foo && git init)
  $ git clone foo bar
  Initialized empty Git repository in /home/peff/bar/.git/
  warning: You appear to have cloned an empty repository.
  $ cd bar && git fetch

which hangs on a pipe read(). It bisects to 61b075b (Support taking over transports, 2009-12-09) from Ilari (cc'd). It looks like we get the empty ref list once in get_remote_heads, and then try to get it again and hang. Maybe we need this?

diff --git a/transport.c b/transport.c
index ad25b98..e6f9464 100644
--- a/transport.c
+++ b/transport.c
@@ -1010,7 +1010,8 @@ int transport_push(struct transport *transport,
 
 const struct ref *transport_get_remote_refs(struct transport *transport)
 {
-	if (!transport->remote_refs)
+	struct git_transport_data *data = transport->data;
+	if (!data->got_remote_heads)
 		transport->remote_refs = transport->get_refs_list(transport, 0);
 
 	return transport->remote_refs;

That fixes the problem for me, but I am totally clueless about this
code. Do all transports have a git_transport_data (if so, then why is it
a void pointer?).

-Peff
Previous: Kevin MenardNext: Tay Ray Chuan
Message 2 of 7 in “git fetch origin hanging in 1.7.0”
  1. Kevin MenardFeb 16, 2010
  2. Jeff KingFeb 16, 2010
  3. Tay Ray ChuanFeb 16, 2010
  4. Jeff KingFeb 16, 2010
  5. Tay Ray ChuanFeb 16, 2010
  6. Kevin MenardFeb 16, 2010
  7. Ilari LiusvaaraFeb 16, 2010

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.