Nicolas Pitre <nico@xxxxxxxxxxx> writes: > Thing is... I don't know if the --max-pack-size argument is really that > used. I'd expect people relying on that feature to use the config > variable instead,... I suspect one of us need to be careful not to forget this thing... -- >8 -- Subject: pack-objects --max-pack-size=<n> counts in bytes The --window-memory argument and pack.packsizelimit configuration used by the same program counted in bytes and honored the standard k/m/g suffixes. Make this option do the same for consistency. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- Documentation/RelNotes-1.7.0.txt | 6 ++++++ Documentation/git-pack-objects.txt | 3 ++- builtin-pack-objects.c | 7 +++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/RelNotes-1.7.0.txt b/Documentation/RelNotes-1.7.0.txt index 323ae54..adf8824 100644 --- a/Documentation/RelNotes-1.7.0.txt +++ b/Documentation/RelNotes-1.7.0.txt @@ -46,6 +46,12 @@ Notes on behaviour change environment, and diff.*.command and diff.*.textconv in the config file. + * "git pack-objects --max-pack-size=<n>" used to count in megabytes, + which was inconsistent with its corresponding configuration + variable and other options the command takes. Now it counts in bytes + and allows standard k/m/g suffixes to be given. + + Updates since v1.6.6 -------------------- diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt index 097a147..fdaf775 100644 --- a/Documentation/git-pack-objects.txt +++ b/Documentation/git-pack-objects.txt @@ -106,7 +106,8 @@ base-name:: default. --max-pack-size=<n>:: - Maximum size of each output packfile, expressed in MiB. + Maximum size of each output packfile, expressed in bytes. The + size can be suffixed with "k", "m", or "g". If specified, multiple packfiles may be created. The default is unlimited, unless the config variable `pack.packSizeLimit` is set. diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 4a41547..33e11d7 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -2203,11 +2203,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) continue; } if (!prefixcmp(arg, "--max-pack-size=")) { - char *end; - pack_size_limit_cfg = 0; - pack_size_limit = strtoul(arg+16, &end, 0) * 1024 * 1024; - if (!arg[16] || *end) + unsigned long ul = 0; + if (!git_parse_ulong(arg + 16, &ul)) usage(pack_usage); + pack_size_limit_cfg = ul; continue; } if (!prefixcmp(arg, "--window=")) { -- 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