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

Re: git-push through git protocol

From
Linus Torvalds <torvalds@osdl.org>
Date
Jan 21, 2007, 22:00 UTC
Message-ID
<Pine.LNX.4.64.0701211341300.14248@woody.osdl.org>
In-Reply-To
<17843.55730.456139.247155@lisa.zopyra.com>
On Sun, 21 Jan 2007, Bill Lear wrote:
>
> I did the steenking testing and it appears to fail.

Ok, I did the test too. It does _appear_ to fail, where the keyword is actually the "appear".

I get
	[torvalds@woody new-repo]$ git push
	updating 'refs/heads/master'
	  from b66385f8f77014d9c3985b1ed1654401508392ad
	  to   2cd693b97b450378fa300ddf6b093aef236953cd
	Generating pack...
	Done counting 4 objects.
	Result has 3 objects.
	Deltifying 3 objects.
	 100% (3/3) done
	Writing 3 objects.
	 100% (3/3) done
	Total 3 (delta 0), reused 0 (delta 0)
	fatal: read error (Bad file descriptor)

On the pushing side, but it all did actually work fine, and trying to push again gets you a

	[torvalds@woody new-repo]$ git push
	Everything up-to-date
and the repo I pushed to did get the changes and checks out ok.
So the patch works, but yeah, there's a few issues:
 - the native git:// protocol doesn't open a stream for stderr like ssh 
   does, so all the nice status updates go to the _daemon_ stderr, and on 
   the daemon side I see:
	Unpacking 3 objects
	 100% (3/3) done
	refs/heads/master: b66385f8f77014d9c3985b1ed1654401508392ad -> 2cd693b97b450378fa300ddf6b093aef236953cd
   which might actually be nice from a debugging and logging standpoint, 
   except it doesn't log enough to really be useful.
 - git-send-pack wants expects the status report, and doesn't get one. 
   That, in turn, seems to be because it expects "out" and "in" to be 
   different file descriptors, and with the git:// protocol they aren't 
   (they're the same file descriptor)
This attached patch should fix the second problem. Maybe.
		Linus
---
diff --git a/send-pack.c b/send-pack.c
index cd478dd..3d3ca07 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -327,6 +327,8 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
 	}
 
 	packet_flush(out);
+	if (out == in)
+		out = dup(out);
 	if (new_refs)
 		ret = pack_objects(out, remote_refs);
 	close(out);
Previous: Bill LearNext: Linus Torvalds
Message 7 of 22 in “git-push through git protocol”
  1. Bill LearJan 21, 2007
  2. Jakub NarebskiJan 21, 2007
  3. Linus TorvaldsJan 21, 2007
  4. Bill LearJan 21, 2007
  5. Johannes SchindelinJan 21, 2007
  6. Bill LearJan 21, 2007
  7. Linus TorvaldsJan 21, 2007
  8. Linus TorvaldsJan 22, 2007
  9. Junio C HamanoJan 22, 2007
  10. Make sure git_connect() always give two file descriptors.Junio C Hamano, Jan 22, 2007
  11. Linus TorvaldsJan 22, 2007
  12. Bill LearJan 22, 2007
  13. Bill LearJan 22, 2007
  14. Linus TorvaldsJan 22, 2007
  15. Martin LanghoffJan 22, 2007
  16. Linus TorvaldsJan 22, 2007
  17. Bill LearJan 22, 2007
  18. Bill LearJan 22, 2007
  19. Martin LanghoffJan 21, 2007
  20. Bill LearJan 22, 2007
  21. Martin LanghoffJan 22, 2007
  22. Jakub NarebskiJan 22, 2007

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.