git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: keithp@keithp.com, Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: git-fetch per-repository speed issues
Date: Mon, 03 Jul 2006 21:30:41 -0700	[thread overview]
Message-ID: <1151987441.4723.110.camel@neko.keithp.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0607032039010.12404@g5.osdl.org>

[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-07-04  4:31 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-03 18:02 git-fetch per-repository speed issues Keith Packard
2006-07-03 23:14 ` Linus Torvalds
2006-07-04  0:21   ` Jeff King
2006-07-04  1:22     ` Ryan Anderson
2006-07-04  1:44       ` Jeff King
2006-07-04  1:55         ` Ryan Anderson
2006-07-04  3:07     ` Linus Torvalds
2006-07-05  6:47       ` Jeff King
2006-07-05 16:40         ` Linus Torvalds
2006-07-04  6:44     ` Jakub Narebski
     [not found]   ` <1151973438.4723.70.camel@neko.keithp.com>
2006-07-04  3:21     ` Linus Torvalds
2006-07-04  3:30       ` Junio C Hamano
2006-07-04  3:40         ` Linus Torvalds
2006-07-04  4:30           ` Keith Packard [this message]
2006-07-04 11:10             ` Andreas Ericsson
2006-07-04 11:18               ` Matthias Kestenholz
2006-07-04 12:05                 ` Andreas Ericsson
2006-07-04  4:02       ` Keith Packard
2006-07-04  4:19         ` Linus Torvalds
2006-07-04  5:05           ` Keith Packard
2006-07-04  5:36             ` Linus Torvalds
2006-07-04  6:21               ` Junio C Hamano
2006-07-04  5:29           ` Keith Packard
2006-07-04  5:53             ` Linus Torvalds
2006-07-04 15:42 ` Jakub Narebski
2006-07-04 16:30   ` Thomas Glanzmann
2006-07-04 17:45   ` Junio C Hamano
2006-07-04 19:22     ` Linus Torvalds
2006-07-04 21:05       ` Junio C Hamano
2006-07-06 23:36 ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1151987441.4723.110.camel@neko.keithp.com \
    --to=keithp@keithp.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).