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

[PATCH v3 3/4] pack-objects: use --objects-edge-aggressive only for shallow repos

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Dec 23, 2014, 12:01 UTC
Message-ID
<1419336082-283091-4-git-send-email-sandals@crustytoothpaste.net>
In-Reply-To
<1419336082-283091-1-git-send-email-sandals@crustytoothpaste.net>

Using --objects-edge-aggressive is important for shallow repos, as it can result in a much smaller pack (in some cases, 10% of the size). However, it performs poorly on large non-shallow repositories with many refs. Since shallow repositories are less likely to have many refs (due to having less history), the smaller pack size is advantageous there. Adjust pack-objects to use --objects-edge-aggressive only for shallow repositories.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/rev-list-options.txt | 3 ++-
 builtin/pack-objects.c             | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 8cb6f92..2984f40 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -659,7 +659,8 @@ These options are mostly targeted for packing of Git repositories.
 
 --objects-edge-aggressive::
 	Similar to `--objects-edge`, but it tries harder to find excluded
-	commits at the cost of increased time.
+	commits at the cost of increased time.  This is used instead of
+	`--objects-edge` to build ``thin'' packs for shallow repositories.
 
 --unpacked::
 	Only useful with `--objects`; print the object IDs that are not
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 3f9f5c7..f3ba861 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2711,7 +2711,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 	argv_array_push(&rp, "pack-objects");
 	if (thin) {
 		use_internal_rev_list = 1;
-		argv_array_push(&rp, "--objects-edge");
+		argv_array_push(&rp, is_repository_shallow()
+				? "--objects-edge-aggressive"
+				: "--objects-edge");
 	} else
 		argv_array_push(&rp, "--objects");
 
-- 
2.2.1.209.g41e5f3a
Previous: brian m. carlsonNext: brian m. carlson
Message 8 of 11 in “Improve push performance with lots of refs”
  1. 0/4 Improve push performance with lots of refsbrian m. carlson, Dec 23, 2014
  2. 1/4 Documentation: add missing article in rev-list-options.txtbrian m. carlson, Dec 23, 2014
  3. 2/4 rev-list: add an option to mark fewer edges as uninterestingbrian m. carlson, Dec 23, 2014
  4. Michael BlumeDec 23, 2014
  5. Jeff KingDec 23, 2014
  6. Junio C HamanoDec 23, 2014
  7. brian m. carlsonDec 24, 2014
  8. 3/4 pack-objects: use --objects-edge-aggressive only for shallow reposbrian m. carlson, Dec 23, 2014
  9. 4/4 upload-pack: use --objects-edge-aggressive for shallow fetchesbrian m. carlson, Dec 23, 2014
  10. Junio C HamanoDec 23, 2014
  11. brian m. carlsonDec 24, 2014

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.