diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-02-04 11:10:44 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-04 15:12:17 -0800 |
commit | 4d0cc2243778b38c3759c6a08f4f1ed64155a070 (patch) | |
tree | a9f28cfa907d1b0a19c0661ef4562dc4b5036418 /fast-import.c | |
parent | 9f17688d93c18bdd0532d2733710dc4d23921282 (diff) | |
download | git-4d0cc2243778b38c3759c6a08f4f1ed64155a070.tar.gz |
fast-import: count --max-pack-size in bytes
Similar in spirit to 07cf0f2 (make --max-pack-size argument to 'git
pack-object' count in bytes, 2010-02-03) which made the option by the same
name to pack-objects, this counts the pack size limit in bytes.
In order not to cause havoc with people used to the previous megabyte
scale an integer smaller than 8192 is interpreted in megabytes but the
user gets a warning. Also a minimum size of 1 MiB is enforced to avoid an
explosion of pack files.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'fast-import.c')
-rw-r--r-- | fast-import.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fast-import.c b/fast-import.c index a6730d0bac..b477dc6a8f 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2764,11 +2764,6 @@ static void option_date_format(const char *fmt) die("unknown --date-format argument %s", fmt); } -static void option_max_pack_size(const char *packsize) -{ - max_packsize = strtoumax(packsize, NULL, 0) * 1024 * 1024; -} - static void option_depth(const char *depth) { max_depth = strtoul(depth, NULL, 0); @@ -2798,7 +2793,17 @@ static void option_export_pack_edges(const char *edges) static int parse_one_option(const char *option) { if (!prefixcmp(option, "max-pack-size=")) { - option_max_pack_size(option + 14); + unsigned long v; + if (!git_parse_ulong(option + 14, &v)) + return 0; + if (v < 8192) { + warning("max-pack-size is now in bytes, assuming --max-pack-size=%lum", v); + v *= 1024 * 1024; + } else if (v < 1024 * 1024) { + warning("minimum max-pack-size is 1 MiB"); + v = 1024 * 1024; + } + max_packsize = v; } else if (!prefixcmp(option, "big-file-threshold=")) { unsigned long v; if (!git_parse_ulong(option + 19, &v)) |