summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-03-18 13:50:29 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-03-18 13:50:29 -0700
commit249d54b2311f1ca866dc2ce87c207d700d071101 (patch)
treebb1ac0824918f3eaf9720b93d9f6c5df1c1e8b37 /builtin
parentMerge branch 'sh/finish-tmp-packfile' (diff)
parentrepack: add `repack.packKeptObjects` config var (diff)
downloadtgif-249d54b2311f1ca866dc2ce87c207d700d071101.tar.xz
Merge branch 'jk/repack-pack-keep-objects'
* jk/repack-pack-keep-objects: repack: add `repack.packKeptObjects` config var
Diffstat (limited to 'builtin')
-rw-r--r--builtin/repack.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 49f5857627..6b0b62dcb2 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");