git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix "git clone" for git:// protocol
@ 2008-02-09 16:58 Johannes Schindelin
  2008-02-09 17:16 ` Daniel Barkalow
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2008-02-09 16:58 UTC (permalink / raw)
  To: git, gitster, barkalow


In the commit "Reduce the number of connects when fetching", we checked 
the return value of git_connect() to see if the connection was successful.

However, for the git:// protocol, there is no need to have another 
process, so the return value is NULL.

The thing is: git_connect() does not return at all if it fails, so we need 
not check the return value of git_connect().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin-fetch-pack.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index f401352..184782f 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -707,17 +707,13 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 
 	conn = git_connect(fd, (char *)dest, args.uploadpack,
 			   args.verbose ? CONNECT_VERBOSE : 0);
-	if (conn) {
-		get_remote_heads(fd[0], &ref, 0, NULL, 0);
-
-		ref = fetch_pack(&args, fd, conn, ref, dest, nr_heads, heads, NULL);
-		close(fd[0]);
-		close(fd[1]);
-		if (finish_connect(conn))
-			ref = NULL;
-	} else {
+	get_remote_heads(fd[0], &ref, 0, NULL, 0);
+
+	ref = fetch_pack(&args, fd, conn, ref, dest, nr_heads, heads, NULL);
+	close(fd[0]);
+	close(fd[1]);
+	if (finish_connect(conn))
 		ref = NULL;
-	}
 	ret = !ref;
 
 	if (!ret && nr_heads) {
-- 
1.5.4.1264.g42770c

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-10 13:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-09 16:58 [PATCH] Fix "git clone" for git:// protocol Johannes Schindelin
2008-02-09 17:16 ` Daniel Barkalow
2008-02-09 18:05   ` Johannes Schindelin
2008-02-10  3:06   ` Johannes Schindelin
2008-02-10  3:14     ` Daniel Barkalow
2008-02-10  4:15       ` Junio C Hamano
2008-02-10 12:12         ` Johannes Schindelin
2008-02-10 13:45           ` [PATCH] Add a test for git-daemon and clone via " Johannes Schindelin

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).