index-pack: clarify the breached limit
As a small courtesy to users, report what limit was breached. This is especially useful when a push exceeds a server-defined limit, since the user is unlikely to have configured the limit (their host did). Also demonstrate the human-readable message in a test. Helped-by: Taylor Blau <me@ttaylorr.com> Helped-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Matt Cooper <vtbassmatt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e6ebfd0e8c
commit
0cf5fbc2e4
@ -323,8 +323,12 @@ static void use(int bytes)
|
||||
if (signed_add_overflows(consumed_bytes, bytes))
|
||||
die(_("pack too large for current definition of off_t"));
|
||||
consumed_bytes += bytes;
|
||||
if (max_input_size && consumed_bytes > max_input_size)
|
||||
die(_("pack exceeds maximum allowed size"));
|
||||
if (max_input_size && consumed_bytes > max_input_size) {
|
||||
struct strbuf size_limit = STRBUF_INIT;
|
||||
strbuf_humanise_bytes(&size_limit, max_input_size);
|
||||
die(_("pack exceeds maximum allowed size (%s)"),
|
||||
size_limit.buf);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *open_pack_file(const char *pack_name)
|
||||
|
Reference in New Issue
Block a user