Signed-off-by: Nicolas Pitre <nico@xxxxxxxxxxx> --- packv4-create.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packv4-create.c b/packv4-create.c index ed67eb6..2d46d11 100644 --- a/packv4-create.c +++ b/packv4-create.c @@ -15,6 +15,7 @@ #include "pack-revindex.h" +static int pack_compression_seen; static int pack_compression_level = Z_DEFAULT_COMPRESSION; struct data_entry { @@ -1040,12 +1041,30 @@ static void process_one_pack(char *src_pack, char *dst_pack) sha1close(f, NULL, CSUM_CLOSE | CSUM_FSYNC); } +static int git_pack_config(const char *k, const char *v, void *cb) +{ + if (!strcmp(k, "pack.compression")) { + int level = git_config_int(k, v); + if (level == -1) + level = Z_DEFAULT_COMPRESSION; + else if (level < 0 || level > Z_BEST_COMPRESSION) + die("bad pack compression level %d", level); + pack_compression_level = level; + pack_compression_seen = 1; + return 0; + } + return git_default_config(k, v, cb); +} + int main(int argc, char *argv[]) { if (argc != 3) { fprintf(stderr, "Usage: %s <src_packfile> <dst_packfile>\n", argv[0]); exit(1); } + git_config(git_pack_config, NULL); + if (!pack_compression_seen && core_compression_seen) + pack_compression_level = core_compression_level; process_one_pack(argv[1], argv[2]); if (0) dict_dump(); -- 1.8.4.22.g54757b7 -- 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