Skip to content

Commit 16d75fa

Browse files
peffgitster
authored andcommitted
repack: add delta-islands support
Implement simple support for --delta-islands option and repack.useDeltaIslands config variable in git repack. This allows users to setup delta islands in their config and get the benefit of less disk usage while cloning and fetching is still quite fast and not much more CPU intensive. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 28b8a73 commit 16d75fa

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Documentation/config.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,6 +3145,10 @@ repack.packKeptObjects::
31453145
index is being written (either via `--write-bitmap-index` or
31463146
`repack.writeBitmaps`).
31473147

3148+
repack.useDeltaIslands::
3149+
If set to true, makes `git repack` act as if `--delta-islands`
3150+
was passed. Defaults to `false`.
3151+
31483152
repack.writeBitmaps::
31493153
When true, git will write a bitmap index when packing all
31503154
objects to disk (e.g., when `git repack -a` is run). This

Documentation/git-repack.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ depth is 4095.
155155
being removed. In addition, any unreachable loose objects will
156156
be packed (and their loose counterparts removed).
157157

158+
-i::
159+
--delta-islands::
160+
Pass the `--delta-islands` option to `git-pack-objects`, see
161+
linkgit:git-pack-objects[1].
162+
158163
Configuration
159164
-------------
160165

builtin/repack.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
static int delta_base_offset = 1;
1313
static int pack_kept_objects = -1;
1414
static int write_bitmaps;
15+
static int use_delta_islands;
1516
static char *packdir, *packtmp;
1617

1718
static const char *const git_repack_usage[] = {
@@ -40,6 +41,10 @@ static int repack_config(const char *var, const char *value, void *cb)
4041
write_bitmaps = git_config_bool(var, value);
4142
return 0;
4243
}
44+
if (!strcmp(var, "repack.usedeltaislands")) {
45+
use_delta_islands = git_config_bool(var, value);
46+
return 0;
47+
}
4348
return git_default_config(var, value, cb);
4449
}
4550

@@ -194,6 +199,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
194199
N_("pass --local to git-pack-objects")),
195200
OPT_BOOL('b', "write-bitmap-index", &write_bitmaps,
196201
N_("write bitmap index")),
202+
OPT_BOOL('i', "delta-islands", &use_delta_islands,
203+
N_("pass --delta-islands to git-pack-objects")),
197204
OPT_STRING(0, "unpack-unreachable", &unpack_unreachable, N_("approxidate"),
198205
N_("with -A, do not loosen objects older than this")),
199206
OPT_BOOL('k', "keep-unreachable", &keep_unreachable,
@@ -267,6 +274,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
267274
argv_array_pushf(&cmd.args, "--no-reuse-object");
268275
if (write_bitmaps)
269276
argv_array_push(&cmd.args, "--write-bitmap-index");
277+
if (use_delta_islands)
278+
argv_array_push(&cmd.args, "--delta-islands");
270279

271280
if (pack_everything & ALL_INTO_ONE) {
272281
get_non_kept_pack_filenames(&existing_packs, &keep_pack_list);

0 commit comments

Comments
 (0)