threads / patch / 10520

patchCorrect handling of upload-pack in builtin-fetch-pack

Subject: [PATCH] Correct handling of upload-pack in builtin-fetch-pack

## tl;dr

2 messages between Oct 30, 2007 and Oct 30, 2007. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Daniel Barkalow· Oct 30, 2007, 02:35 UTC · lore
The field in the args was being ignored in favor of a static constant
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
Found this while trying to figure out how builtin-fetch-pack was 
initializing the string in the args struct, and why it generally worked 
even though it wasn't.
 builtin-fetch-pack.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
Show changes to builtin-fetch-pack.c +4 −3
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 8f25d50..8753840 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -11,11 +11,12 @@
 static int transfer_unpack_limit = -1;
 static int fetch_unpack_limit = -1;
 static int unpack_limit = 100;
-static struct fetch_pack_args args;
+static struct fetch_pack_args args = {
+	/* .uploadpack = */ "git-upload-pack",
+};
 
 static const char fetch_pack_usage[] =
 "git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
-static const char *uploadpack = "git-upload-pack";
 
 #define COMPLETE	(1U << 0)
 #define COMMON		(1U << 1)
@@ -773,7 +774,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
 			st.st_mtime = 0;
 	}
 
-	pid = git_connect(fd, (char *)dest, uploadpack,
+	pid = git_connect(fd, (char *)dest, args.uploadpack,
                           args.verbose ? CONNECT_VERBOSE : 0);
 	if (pid < 0)
 		return NULL;
-- 
1.5.3.4.1206.g5f96
Shawn O. Pearce· Oct 30, 2007, 02:41 UTC · re: Daniel Barkalow · lore

Re: [PATCH] Correct handling of upload-pack in builtin-fetch-pack

Daniel Barkalow <barkalow@iabervon.org> wrote:
Show 7 quoted lines
> The field in the args was being ignored in favor of a static constant
> 
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
> ---
> Found this while trying to figure out how builtin-fetch-pack was 
> initializing the string in the args struct, and why it generally worked 
> even though it wasn't.
Gahhh.  Yes, obviously correct fix.  Thanks!  :-)
 
Show 20 quoted lines
> -static struct fetch_pack_args args;
> +static struct fetch_pack_args args = {
> +	/* .uploadpack = */ "git-upload-pack",
> +};
>  
>  static const char fetch_pack_usage[] =
>  "git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
> -static const char *uploadpack = "git-upload-pack";
>  
>  #define COMPLETE	(1U << 0)
>  #define COMMON		(1U << 1)
> @@ -773,7 +774,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
>  			st.st_mtime = 0;
>  	}
>  
> -	pid = git_connect(fd, (char *)dest, uploadpack,
> +	pid = git_connect(fd, (char *)dest, args.uploadpack,
>                            args.verbose ? CONNECT_VERBOSE : 0);
>  	if (pid < 0)
>  		return NULL;
-- 
Shawn.

← back to recent threads