path: root/builtin-fetch-pack.c
diff options
authorShawn O. Pearce <>2007-09-19 04:49:39 (GMT)
committerJunio C Hamano <>2007-09-19 10:22:31 (GMT)
commit50ab5fd3fc16fbe01170059977533fa2c7c4d448 (patch)
tree23e9ee385b026ca1de16bbc15b15f46549c20bd2 /builtin-fetch-pack.c
parentfa74052922cf39e5a39ad7178d1b13c2da9b4519 (diff)
Ensure builtin-fetch honors {fetch,transfer}.unpackLimit
The only way to configure the unpacking limit is currently through the .git/config (or ~/.gitconfig) mechanism as we have no existing command line option interface to control this threshold on a per invocation basis. This was intentional by design as the storage policy of the repository should be a repository-wide decision and should not be subject to variations made on individual command executions. Earlier builtin-fetch was bypassing the unpacking limit chosen by the user through the configuration file as it did not reread the configuration options through fetch_pack_config if we called the internal fetch_pack() API directly. We now ensure we always run the config file through fetch_pack_config at least once in this process, thereby setting our unpackLimit properly. Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin-fetch-pack.c')
1 files changed, 13 insertions, 6 deletions
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 77eb181..8f25d50 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -670,18 +670,24 @@ static int fetch_pack_config(const char *var, const char *value)
static struct lock_file lock;
-int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
+static void fetch_pack_setup(void)
- int i, ret, nr_heads;
- struct ref *ref;
- char *dest = NULL, **heads;
+ static int did_setup;
+ if (did_setup)
+ return;
if (0 <= transfer_unpack_limit)
unpack_limit = transfer_unpack_limit;
else if (0 <= fetch_unpack_limit)
unpack_limit = fetch_unpack_limit;
+ did_setup = 1;
+int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
+ int i, ret, nr_heads;
+ struct ref *ref;
+ char *dest = NULL, **heads;
nr_heads = 0;
heads = NULL;
@@ -760,6 +766,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
struct ref *ref;
struct stat st;
+ fetch_pack_setup();
memcpy(&args, my_args, sizeof(args));
if (args.depth > 0) {
if (stat(git_path("shallow"), &st))