|
13 | 13 | static int transfer_unpack_limit = -1; |
14 | 14 | static int fetch_unpack_limit = -1; |
15 | 15 | static int unpack_limit = 100; |
| 16 | +static int prefer_ofs_delta = 1; |
16 | 17 | static struct fetch_pack_args args = { |
17 | 18 | /* .uploadpack = */ "git-upload-pack", |
18 | 19 | }; |
@@ -200,7 +201,7 @@ static int find_common(int fd[2], unsigned char *result_sha1, |
200 | 201 | (args.use_thin_pack ? " thin-pack" : ""), |
201 | 202 | (args.no_progress ? " no-progress" : ""), |
202 | 203 | (args.include_tag ? " include-tag" : ""), |
203 | | - " ofs-delta"); |
| 204 | + (prefer_ofs_delta ? " ofs-delta" : "")); |
204 | 205 | else |
205 | 206 | packet_write(fd[1], "want %s\n", sha1_to_hex(remote)); |
206 | 207 | fetching++; |
@@ -597,6 +598,11 @@ static struct ref *do_fetch_pack(int fd[2], |
597 | 598 | fprintf(stderr, "Server supports side-band\n"); |
598 | 599 | use_sideband = 1; |
599 | 600 | } |
| 601 | + if (server_supports("ofs-delta")) { |
| 602 | + if (args.verbose) |
| 603 | + fprintf(stderr, "Server supports ofs-delta\n"); |
| 604 | + } else |
| 605 | + prefer_ofs_delta = 0; |
600 | 606 | if (everything_local(&ref, nr_match, match)) { |
601 | 607 | packet_flush(fd[1]); |
602 | 608 | goto all_done; |
@@ -649,6 +655,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb) |
649 | 655 | return 0; |
650 | 656 | } |
651 | 657 |
|
| 658 | + if (strcmp(var, "repack.usedeltabaseoffset") == 0) { |
| 659 | + prefer_ofs_delta = git_config_bool(var, value); |
| 660 | + return 0; |
| 661 | + } |
| 662 | + |
652 | 663 | return git_default_config(var, value, cb); |
653 | 664 | } |
654 | 665 |
|
|
0 commit comments