[PATCH] Fix "git clone" for git:// protocol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux