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

Re: git-fetch per-repository speed issues

From
Keith Packard <keithp@keithp.com>
Date
Jul 4, 2006, 04:30 UTC
Message-ID
<1151987441.4723.110.camel@neko.keithp.com>
In-Reply-To
<Pine.LNX.4.64.0607032039010.12404@g5.osdl.org>
On Mon, 2006-07-03 at 20:40 -0700, Linus Torvalds wrote:
>     "And, it's painfully slow, even when the repository is up to date"
> 
> and gave a 17-second time.

It's faster this evening, down to 8 seconds using ssh and 4 seconds using git. I clearly need to force use of the git protocol. Anyone else like the attached patch?

---
 connect.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/connect.c b/connect.c
index 9a87bd9..e74eddc 100644
--- a/connect.c
+++ b/connect.c
@@ -303,6 +303,7 @@ enum protocol {
 	PROTO_LOCAL = 1,
 	PROTO_SSH,
 	PROTO_GIT,
+	PROTO_GIT_SSH,
 };
 
 static enum protocol get_protocol(const char *name)
@@ -312,9 +313,9 @@ static enum protocol get_protocol(const 
 	if (!strcmp(name, "git"))
 		return PROTO_GIT;
 	if (!strcmp(name, "git+ssh"))
-		return PROTO_SSH;
+		return PROTO_GIT_SSH;
 	if (!strcmp(name, "ssh+git"))
-		return PROTO_SSH;
+		return PROTO_GIT_SSH;
 	die("I don't handle protocol '%s'", name);
 }
 
@@ -572,6 +573,14 @@ static void git_proxy_connect(int fd[2],
 	close(pipefd[1][0]);
 }
 
+/* returns whether the specified command can be interpreted by the
daemon */
+int git_is_daemon_command (const char *prog) 
+{
+	if (!strcmp("git-upload-pack", prog))
+		return 1;
+	return 0;
+}
+
 /*
  * Yeah, yeah, fixme. Need to pass in the heads etc.
  */
@@ -641,7 +650,8 @@ int git_connect(int fd[2], char *url, co
 		*ptr = '\0';
 	}
 
-	if (protocol == PROTO_GIT) {
+	if (protocol == PROTO_GIT || 
+	    (protocol == PROTO_GIT_SSH && git_is_daemon_command (prog))) {
 		/* These underlying connection commands die() if they
 		 * cannot connect.
 		 */
@@ -678,7 +688,7 @@ int git_connect(int fd[2], char *url, co
 		close(pipefd[0][1]);
 		close(pipefd[1][0]);
 		close(pipefd[1][1]);
-		if (protocol == PROTO_SSH) {
+		if (protocol == PROTO_SSH || protocol == PROTO_GIT_SSH) {
 			const char *ssh, *ssh_basename;
 			ssh = getenv("GIT_SSH");
 			if (!ssh) ssh = "ssh";
-- 
1.4.1.g8fced-dirty

-- 
keith.packard@intel.com
Previous: Linus TorvaldsNext: Andreas Ericsson
Message 20 of 30 in “git-fetch per-repository speed issues”
  1. Keith PackardJul 3, 2006
  2. Linus TorvaldsJul 3, 2006
  3. Jeff KingJul 4, 2006
  4. Ryan AndersonJul 4, 2006
  5. Jeff KingJul 4, 2006
  6. Ryan AndersonJul 4, 2006
  7. Linus TorvaldsJul 4, 2006
  8. Jeff KingJul 5, 2006
  9. Linus TorvaldsJul 5, 2006
  10. Jakub NarebskiJul 4, 2006
  11. Jakub NarebskiJul 4, 2006
  12. Thomas GlanzmannJul 4, 2006
  13. Junio C HamanoJul 4, 2006
  14. Linus TorvaldsJul 4, 2006
  15. Junio C HamanoJul 4, 2006
  16. David WoodhouseJul 6, 2006
  17. Linus TorvaldsJul 4, 2006
  18. Junio C HamanoJul 4, 2006
  19. Linus TorvaldsJul 4, 2006
  20. Keith PackardJul 4, 2006
  21. Andreas EricssonJul 4, 2006
  22. Matthias KestenholzJul 4, 2006
  23. Andreas EricssonJul 4, 2006
  24. Keith PackardJul 4, 2006
  25. Linus TorvaldsJul 4, 2006
  26. Keith PackardJul 4, 2006
  27. Linus TorvaldsJul 4, 2006
  28. Junio C HamanoJul 4, 2006
  29. Keith PackardJul 4, 2006
  30. Linus TorvaldsJul 4, 2006

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.