summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-24 21:36:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-24 21:36:27 (GMT)
commit2744383cbda9bbbe4219bd3532757ae6d28460e1 (patch)
tree8ca08ee3555ef97487136e9e9de5699ca19d8990 /revision.c
parentc6617d1e4f462405e6e237a21026c1cf3b557ec0 (diff)
parent14e7b8344f0b7349b914331c0aff18f73faf03da (diff)
downloadgit-2744383cbda9bbbe4219bd3532757ae6d28460e1.zip
git-2744383cbda9bbbe4219bd3532757ae6d28460e1.tar.gz
git-2744383cbda9bbbe4219bd3532757ae6d28460e1.tar.bz2
Merge branch 'tb/geometric-repack'
"git repack" so far has been only capable of repacking everything under the sun into a single pack (or split by size). A cleverer strategy to reduce the cost of repacking a repository has been introduced. * tb/geometric-repack: builtin/pack-objects.c: ignore missing links with --stdin-packs builtin/repack.c: reword comment around pack-objects flags builtin/repack.c: be more conservative with unsigned overflows builtin/repack.c: assign pack split later t7703: test --geometric repack with loose objects builtin/repack.c: do not repack single packs with --geometric builtin/repack.c: add '--geometric' option packfile: add kept-pack cache for find_kept_pack_entry() builtin/pack-objects.c: rewrite honor-pack-keep logic p5303: measure time to repack with keep p5303: add missing &&-chains builtin/pack-objects.c: add '--stdin-packs' option revision: learn '--no-kept-objects' packfile: introduce 'find_kept_pack_entry()'
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 99c859f..553c0fa 100644
--- a/revision.c
+++ b/revision.c
@@ -2336,6 +2336,16 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->unpacked = 1;
} else if (starts_with(arg, "--unpacked=")) {
die(_("--unpacked=<packfile> no longer supported"));
+ } else if (!strcmp(arg, "--no-kept-objects")) {
+ revs->no_kept_objects = 1;
+ revs->keep_pack_cache_flags |= IN_CORE_KEEP_PACKS;
+ revs->keep_pack_cache_flags |= ON_DISK_KEEP_PACKS;
+ } else if (skip_prefix(arg, "--no-kept-objects=", &optarg)) {
+ revs->no_kept_objects = 1;
+ if (!strcmp(optarg, "in-core"))
+ revs->keep_pack_cache_flags |= IN_CORE_KEEP_PACKS;
+ if (!strcmp(optarg, "on-disk"))
+ revs->keep_pack_cache_flags |= ON_DISK_KEEP_PACKS;
} else if (!strcmp(arg, "-r")) {
revs->diff = 1;
revs->diffopt.flags.recursive = 1;
@@ -3795,6 +3805,11 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
return commit_ignore;
if (revs->unpacked && has_object_pack(&commit->object.oid))
return commit_ignore;
+ if (revs->no_kept_objects) {
+ if (has_object_kept_pack(&commit->object.oid,
+ revs->keep_pack_cache_flags))
+ return commit_ignore;
+ }
if (commit->object.flags & UNINTERESTING)
return commit_ignore;
if (revs->line_level_traverse && !want_ancestry(revs)) {