X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-fetch-pack.c;h=87f46c6d07ccb0f82449b92e33cd4cda76a99da3;hb=5a0e4a2a326966aabb566164a7571291e34adabd;hp=5d134be47c85019dd66aed742eb845f6245cbf4d;hpb=3c91bf6805249d0f59ddff4e5dc4118127527243;p=git.git diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 5d134be47..87f46c6d0 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -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", }; @@ -111,7 +112,7 @@ static void mark_common(struct commit *commit, Get the next rev to send, ignoring the common. */ -static const unsigned char* get_rev(void) +static const unsigned char *get_rev(void) { struct commit *commit = NULL; @@ -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++; @@ -596,6 +597,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; @@ -648,6 +654,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); }