summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-18 20:50:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-18 20:50:29 (GMT)
commit249d54b2311f1ca866dc2ce87c207d700d071101 (patch)
treebb1ac0824918f3eaf9720b93d9f6c5df1c1e8b37 /builtin/repack.c
parentf4eec8ce05e725a5e30d3d29c47093d4e3e0ce7e (diff)
parentee34a2beadb94a9595f09af719e3c09b485ca797 (diff)
downloadgit-249d54b2311f1ca866dc2ce87c207d700d071101.zip
git-249d54b2311f1ca866dc2ce87c207d700d071101.tar.gz
git-249d54b2311f1ca866dc2ce87c207d700d071101.tar.bz2
Merge branch 'jk/repack-pack-keep-objects'
* jk/repack-pack-keep-objects: repack: add `repack.packKeptObjects` config var
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 49f5857..6b0b62d 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -9,6 +9,7 @@
#include "argv-array.h"
static int delta_base_offset = 1;
+static int pack_kept_objects = -1;
static char *packdir, *packtmp;
static const char *const git_repack_usage[] = {
@@ -22,6 +23,10 @@ static int repack_config(const char *var, const char *value, void *cb)
delta_base_offset = git_config_bool(var, value);
return 0;
}
+ if (!strcmp(var, "repack.packkeptobjects")) {
+ pack_kept_objects = git_config_bool(var, value);
+ return 0;
+ }
return git_default_config(var, value, cb);
}
@@ -175,6 +180,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
N_("limits the maximum delta depth")),
OPT_STRING(0, "max-pack-size", &max_pack_size, N_("bytes"),
N_("maximum size of each packfile")),
+ OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
+ N_("repack objects in packs marked with .keep")),
OPT_END()
};
@@ -183,6 +190,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, builtin_repack_options,
git_repack_usage, 0);
+ if (pack_kept_objects < 0)
+ pack_kept_objects = write_bitmap;
+
packdir = mkpathdup("%s/pack", get_object_directory());
packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
@@ -190,7 +200,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
argv_array_push(&cmd_args, "pack-objects");
argv_array_push(&cmd_args, "--keep-true-parents");
- argv_array_push(&cmd_args, "--honor-pack-keep");
+ if (!pack_kept_objects)
+ argv_array_push(&cmd_args, "--honor-pack-keep");
argv_array_push(&cmd_args, "--non-empty");
argv_array_push(&cmd_args, "--all");
argv_array_push(&cmd_args, "--reflog");