git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 4/7] repack: add delta-islands support

From
Christian Couder <christian.couder@gmail.com>
Date
Aug 12, 2018, 05:11 UTC
Message-ID
<20180812051151.6425-5-chriscool@tuxfamily.org>
In-Reply-To
<20180812051151.6425-1-chriscool@tuxfamily.org>
From: Jeff King <peff@peff.net>

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 <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 Documentation/config.txt     | 4 ++++
 Documentation/git-repack.txt | 5 +++++
 builtin/repack.c             | 9 +++++++++
 3 files changed, 18 insertions(+)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 27bb77f9e7..2bd31078b2 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -3145,6 +3145,10 @@ repack.packKeptObjects::
 	index is being written (either via `--write-bitmap-index` or
 	`repack.writeBitmaps`).
 
+repack.useDeltaIslands::
+	If set to true, makes `git repack` act as if `--delta-islands`
+	was passed. Defaults to `false`.
+
 repack.writeBitmaps::
 	When true, git will write a bitmap index when packing all
 	objects to disk (e.g., when `git repack -a` is run).  This
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index d90e7907f4..a8b2d4722f 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -155,6 +155,11 @@ depth is 4095.
 	being removed. In addition, any unreachable loose objects will
 	be packed (and their loose counterparts removed).
 
+-i::
+--delta-islands::
+	Pass the `--delta-islands` option to `git-pack-objects`, see
+	linkgit:git-pack-objects[1].
+
 Configuration
 -------------
 
diff --git a/builtin/repack.c b/builtin/repack.c
index 6c636e159e..5ab9ee69e4 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -12,6 +12,7 @@
 static int delta_base_offset = 1;
 static int pack_kept_objects = -1;
 static int write_bitmaps;
+static int use_delta_islands;
 static char *packdir, *packtmp;
 
 static const char *const git_repack_usage[] = {
@@ -40,6 +41,10 @@ static int repack_config(const char *var, const char *value, void *cb)
 		write_bitmaps = git_config_bool(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "repack.usedeltaislands")) {
+		use_delta_islands = git_config_bool(var, value);
+		return 0;
+	}
 	return git_default_config(var, value, cb);
 }
 
@@ -194,6 +199,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 				N_("pass --local to git-pack-objects")),
 		OPT_BOOL('b', "write-bitmap-index", &write_bitmaps,
 				N_("write bitmap index")),
+		OPT_BOOL('i', "delta-islands", &use_delta_islands,
+				N_("pass --delta-islands to git-pack-objects")),
 		OPT_STRING(0, "unpack-unreachable", &unpack_unreachable, N_("approxidate"),
 				N_("with -A, do not loosen objects older than this")),
 		OPT_BOOL('k', "keep-unreachable", &keep_unreachable,
@@ -267,6 +274,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 		argv_array_pushf(&cmd.args, "--no-reuse-object");
 	if (write_bitmaps)
 		argv_array_push(&cmd.args, "--write-bitmap-index");
+	if (use_delta_islands)
+		argv_array_push(&cmd.args, "--delta-islands");
 
 	if (pack_everything & ALL_INTO_ONE) {
 		get_non_kept_pack_filenames(&existing_packs, &keep_pack_list);
-- 
2.18.0.554.gdb07901040.dirty
Previous: Christian CouderNext: Christian Couder
Message 12 of 15 in “Add delta islands support”
  1. 0/7 Add delta islands supportChristian Couder, Aug 12, 2018
  2. 1/7 Add delta-islands.{c,h}Christian Couder, Aug 12, 2018
  3. Ramsay JonesAug 13, 2018
  4. Christian CouderAug 13, 2018
  5. Ramsay JonesAug 13, 2018
  6. Jeff KingAug 13, 2018
  7. Christian CouderAug 16, 2018
  8. Jeff KingAug 13, 2018
  9. Christian CouderAug 16, 2018
  10. 5/7 t: add t5319-delta-islands.shChristian Couder, Aug 12, 2018
  11. 2/7 pack-objects: refactor code into compute_layer_order()Christian Couder, Aug 12, 2018
  12. 4/7 repack: add delta-islands supportChristian Couder, Aug 12, 2018
  13. 3/7 pack-objects: add delta-islands supportChristian Couder, Aug 12, 2018
  14. 6/7 pack-objects: move tree_depth into 'struct packing_data'Christian Couder, Aug 12, 2018
  15. 7/7 pack-objects: move 'layer' into 'struct packing_data'Christian Couder, Aug 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.