This is just a direct translation of http://article.gmane.org/gmane.comp.version-control.git/235396 So I don't consider this is ready for inclusion. Some notes: We need to have more error checking, repack shall be 0, 2 or 4 but nothing else. If 0 is given, no argument is passed to pack-objects, in case of 2 or 4 --version=<n> is passed. Do we really want to call it "--version"? This parameter sounds so much like questioning for the program version, similar to git --version 1.8.4 So I'd rather use "--repack-version". --- builtin/repack.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/repack.c b/builtin/repack.c index 3e56614..fd05e9a 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_version; static char *packdir, *packtmp; static const char *const git_repack_usage[] = { @@ -22,6 +23,9 @@ 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, "core.preferredPackVersion")) { + pack_version = git_config_int(var, value); + } return git_default_config(var, value, cb); } @@ -165,6 +169,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix) N_("limits the maximum delta depth")), OPT_INTEGER(0, "max-pack-size", &max_pack_size, N_("maximum size of each packfile")), + OPT_INTEGER(0, "pack-version", &pack_version, + N_("format version of the output pack")), OPT_END() }; @@ -220,6 +226,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix) argv_array_push(&cmd_args, "--quiet"); if (delta_base_offset) argv_array_push(&cmd_args, "--delta-base-offset"); + if (pack_version) + argv_array_pushf(&cmd_args, "--version=%u", pack_version); argv_array_push(&cmd_args, packtmp); -- 1.8.4.474.g128a96c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html