Skip to content

Commit

Permalink
honor repack.usedeltabaseoffset when fetching packs
Browse files Browse the repository at this point in the history
If the local receiving repository has disabled the use of delta base
offset, for example to retain compatibility with older versions of
Git that predate OFS_DELTA, we shouldn't ask for ofs-delta support
when we obtain a pack from the remote server.

[ issue noticed by Shawn Pearce ]

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nicolas Pitre authored and Junio C Hamano committed May 2, 2009
1 parent a2dc04b commit f04833e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion builtin-fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1;
static int unpack_limit = 100;
static int prefer_ofs_delta = 1;
static struct fetch_pack_args args = {
/* .uploadpack = */ "git-upload-pack",
};
Expand Down Expand Up @@ -200,7 +201,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
(args.use_thin_pack ? " thin-pack" : ""),
(args.no_progress ? " no-progress" : ""),
(args.include_tag ? " include-tag" : ""),
" ofs-delta");
(prefer_ofs_delta ? " ofs-delta" : ""));
else
packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
fetching++;
Expand Down Expand Up @@ -597,6 +598,11 @@ static struct ref *do_fetch_pack(int fd[2],
fprintf(stderr, "Server supports side-band\n");
use_sideband = 1;
}
if (server_supports("ofs-delta")) {
if (args.verbose)
fprintf(stderr, "Server supports ofs-delta\n");
} else
prefer_ofs_delta = 0;
if (everything_local(&ref, nr_match, match)) {
packet_flush(fd[1]);
goto all_done;
Expand Down Expand Up @@ -649,6 +655,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
return 0;
}

if (strcmp(var, "repack.usedeltabaseoffset") == 0) {
prefer_ofs_delta = git_config_bool(var, value);
return 0;
}

return git_default_config(var, value, cb);
}

Expand Down

0 comments on commit f04833e

Please sign in to comment.