summaryrefslogtreecommitdiff
path: root/builtin/prune.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-12-08 15:27:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-08 17:52:42 (GMT)
commit0c16cd499dee09b7fc6dd10cb6a476e96c147ef6 (patch)
tree782bff532cd6dc373c26979de66eb9abbf872b6a /builtin/prune.c
parentdf11e1964825b825e179ccdbc1b9e3a6fc09e67a (diff)
downloadgit-0c16cd499dee09b7fc6dd10cb6a476e96c147ef6.zip
git-0c16cd499dee09b7fc6dd10cb6a476e96c147ef6.tar.gz
git-0c16cd499dee09b7fc6dd10cb6a476e96c147ef6.tar.bz2
gc: do not repack promisor packfiles
Teach gc to stop traversal at promisor objects, and to leave promisor packfiles alone. This has the effect of only repacking non-promisor packfiles, and preserves the distinction between promisor packfiles and non-promisor packfiles. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/prune.c')
-rw-r--r--builtin/prune.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/prune.c b/builtin/prune.c
index cddabf2..be34645 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -101,12 +101,15 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
struct progress *progress = NULL;
+ int exclude_promisor_objects = 0;
const struct option options[] = {
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
OPT__VERBOSE(&verbose, N_("report pruned objects")),
OPT_BOOL(0, "progress", &show_progress, N_("show progress")),
OPT_EXPIRY_DATE(0, "expire", &expire,
N_("expire objects older than <time>")),
+ OPT_BOOL(0, "exclude-promisor-objects", &exclude_promisor_objects,
+ N_("limit traversal to objects outside promisor packfiles")),
OPT_END()
};
char *s;
@@ -139,6 +142,10 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
show_progress = isatty(2);
if (show_progress)
progress = start_delayed_progress(_("Checking connectivity"), 0);
+ if (exclude_promisor_objects) {
+ fetch_if_missing = 0;
+ revs.exclude_promisor_objects = 1;
+ }
mark_reachable_objects(&revs, 1, expire, progress);
stop_progress(&progress);