summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-09-19 04:49:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-19 10:22:31 (GMT)
commitfa74052922cf39e5a39ad7178d1b13c2da9b4519 (patch)
tree2a2383807927a2943ba5a40af1b403ba74edcf0f /transport.c
parent824d5776c3f275c644c71b8c7e254bd2d7b08071 (diff)
downloadgit-fa74052922cf39e5a39ad7178d1b13c2da9b4519.zip
git-fa74052922cf39e5a39ad7178d1b13c2da9b4519.tar.gz
git-fa74052922cf39e5a39ad7178d1b13c2da9b4519.tar.bz2
Always obtain fetch-pack arguments from struct fetch_pack_args
Copying the arguments from a fetch_pack_args into static globals within the builtin-fetch-pack module is error-prone and may lead rise to cases where arguments supplied via the struct from the new fetch_pack() API may not be honored by the implementation. Here we reorganize all of the static globals into a single static struct fetch_pack_args instance and use memcpy() to move the data from the caller supplied structure into the globals before we execute our pack fetching implementation. This strategy is more robust to additions and deletions of properties. As keep_pack is a single bit we have also introduced lock_pack to mean not only download and store the packfile via index-pack but also to lock it against repacking by creating a .keep file when the packfile itself is stored. The caller must remove the .keep file when it is safe to do so. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/transport.c b/transport.c
index d8458dc..85f5b1e 100644
--- a/transport.c
+++ b/transport.c
@@ -314,21 +314,18 @@ static int fetch_refs_via_pack(struct transport *transport,
struct fetch_pack_args args;
int i;
+ memset(&args, 0, sizeof(args));
args.uploadpack = data->uploadpack;
- args.quiet = 0;
args.keep_pack = data->keep;
+ args.lock_pack = 1;
args.unpacklimit = data->unpacklimit;
args.use_thin_pack = data->thin;
- args.fetch_all = 0;
args.verbose = transport->verbose;
args.depth = data->depth;
- args.no_progress = 0;
-
- setup_fetch_pack(&args);
for (i = 0; i < nr_heads; i++)
origh[i] = heads[i] = xstrdup(to_fetch[i]->name);
- refs = fetch_pack(dest, nr_heads, heads, &transport->pack_lockfile);
+ refs = fetch_pack(&args, dest, nr_heads, heads, &transport->pack_lockfile);
for (i = 0; i < nr_heads; i++)
free(origh[i]);