From: Junio C Hamano Date: Thu, 13 Feb 2014 21:38:09 +0000 (-0800) Subject: Merge branch 'sb/repack-in-c' into maint X-Git-Tag: v1.8.5.5~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/90791e3416e24a98b38d95e249f3a61fb20a632f?ds=inline;hp=-c Merge branch 'sb/repack-in-c' into maint "git repack --max-pack-size=8g" stopped being parsed correctly when the command was reimplemented in C. * sb/repack-in-c: repack: propagate pack-objects options as strings repack: make parsed string options const-correct repack: fix typo in max-pack-size option --- 90791e3416e24a98b38d95e249f3a61fb20a632f diff --combined builtin/repack.c index 91e2363c71,bca771054e..a2b9dba522 --- a/builtin/repack.c +++ b/builtin/repack.c @@@ -123,16 -123,16 +123,16 @@@ int cmd_repack(int argc, const char **a struct string_list rollback = STRING_LIST_INIT_NODUP; struct string_list existing_packs = STRING_LIST_INIT_DUP; struct strbuf line = STRBUF_INIT; - int nr_packs, ext, ret, failed; + int ext, ret, failed; FILE *out; /* variables to be filled by option parsing */ int pack_everything = 0; int delete_redundant = 0; - char *unpack_unreachable = NULL; - int window = 0, window_memory = 0; - int depth = 0; - int max_pack_size = 0; + const char *unpack_unreachable = NULL; + const char *window = NULL, *window_memory = NULL; + const char *depth = NULL; + const char *max_pack_size = NULL; int no_reuse_delta = 0, no_reuse_object = 0; int no_update_server_info = 0; int quiet = 0; @@@ -157,13 -157,13 +157,13 @@@ N_("pass --local to git-pack-objects")), OPT_STRING(0, "unpack-unreachable", &unpack_unreachable, N_("approxidate"), N_("with -A, do not loosen objects older than this")), - OPT_INTEGER(0, "window", &window, + OPT_STRING(0, "window", &window, N_("n"), N_("size of the window used for delta compression")), - OPT_INTEGER(0, "window-memory", &window_memory, + OPT_STRING(0, "window-memory", &window_memory, N_("bytes"), N_("same as the above, but limit memory size instead of entries count")), - OPT_INTEGER(0, "depth", &depth, + OPT_STRING(0, "depth", &depth, N_("n"), N_("limits the maximum delta depth")), - OPT_INTEGER(0, "max-pack-size", &max_pack_size, + OPT_STRING(0, "max-pack-size", &max_pack_size, N_("bytes"), N_("maximum size of each packfile")), OPT_END() }; @@@ -185,13 -185,13 +185,13 @@@ argv_array_push(&cmd_args, "--all"); argv_array_push(&cmd_args, "--reflog"); if (window) - argv_array_pushf(&cmd_args, "--window=%u", window); + argv_array_pushf(&cmd_args, "--window=%s", window); if (window_memory) - argv_array_pushf(&cmd_args, "--window-memory=%u", window_memory); + argv_array_pushf(&cmd_args, "--window-memory=%s", window_memory); if (depth) - argv_array_pushf(&cmd_args, "--depth=%u", depth); + argv_array_pushf(&cmd_args, "--depth=%s", depth); if (max_pack_size) - argv_array_pushf(&cmd_args, "--max_pack_size=%u", max_pack_size); + argv_array_pushf(&cmd_args, "--max-pack-size=%s", max_pack_size); if (no_reuse_delta) argv_array_pushf(&cmd_args, "--no-reuse-delta"); if (no_reuse_object) @@@ -233,11 -233,13 +233,11 @@@ if (ret) return ret; - nr_packs = 0; out = xfdopen(cmd.out, "r"); while (strbuf_getline(&line, out, '\n') != EOF) { if (line.len != 40) die("repack: Expecting 40 character sha1 lines only from pack-objects."); string_list_append(&names, line.buf); - nr_packs++; } fclose(out); ret = finish_command(&cmd); @@@ -245,7 -247,7 +245,7 @@@ return ret; argv_array_clear(&cmd_args); - if (!nr_packs && !quiet) + if (!names.nr && !quiet) printf("Nothing new to pack.\n"); /*