Merge branch 'rs/commit-h-single-parent-cleanup' into next
[gitweb.git] / builtin / repack.c
index 80dd06b4a2a8b784ab96899cb150b13006d7e402..f17a68a17da960813e6e925837638a5d9a26d5ee 100644 (file)
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "config.h"
 #include "dir.h"
 #include "parse-options.h"
 #include "run-command.h"
@@ -18,6 +19,12 @@ static const char *const git_repack_usage[] = {
        NULL
 };
 
+static const char incremental_bitmap_conflict_error[] = N_(
+"Incremental repacks are incompatible with bitmap indexes.  Use\n"
+"--no-write-bitmap-index or disable the pack.writebitmaps configuration."
+);
+
+
 static int repack_config(const char *var, const char *value, void *cb)
 {
        if (!strcmp(var, "repack.usedeltabaseoffset")) {
@@ -149,6 +156,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        int keep_unreachable = 0;
        const char *window = NULL, *window_memory = NULL;
        const char *depth = NULL;
+       const char *threads = NULL;
        const char *max_pack_size = NULL;
        int no_reuse_delta = 0, no_reuse_object = 0;
        int no_update_server_info = 0;
@@ -184,6 +192,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                                N_("same as the above, but limit memory size instead of entries count")),
                OPT_STRING(0, "depth", &depth, N_("n"),
                                N_("limits the maximum delta depth")),
+               OPT_STRING(0, "threads", &threads, N_("n"),
+                               N_("limits the maximum number of threads")),
                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,
@@ -206,6 +216,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        if (pack_kept_objects < 0)
                pack_kept_objects = write_bitmaps;
 
+       if (write_bitmaps && !(pack_everything & ALL_INTO_ONE))
+               die(_(incremental_bitmap_conflict_error));
+
        packdir = mkpathdup("%s/pack", get_object_directory());
        packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
 
@@ -225,6 +238,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                argv_array_pushf(&cmd.args, "--window-memory=%s", window_memory);
        if (depth)
                argv_array_pushf(&cmd.args, "--depth=%s", depth);
+       if (threads)
+               argv_array_pushf(&cmd.args, "--threads=%s", threads);
        if (max_pack_size)
                argv_array_pushf(&cmd.args, "--max-pack-size=%s", max_pack_size);
        if (no_reuse_delta)