зеркало из https://github.com/microsoft/git.git
Merge branch 'mc/index-pack-report-max-size'
When "index-pack" dies due to incoming data exceeding the maximum allowed input size, include the value of the limit in the error message. * mc/index-pack-report-max-size: index-pack: clarify the breached limit
This commit is contained in:
Коммит
283e4e7cd3
|
@ -323,8 +323,12 @@ static void use(int bytes)
|
||||||
if (signed_add_overflows(consumed_bytes, bytes))
|
if (signed_add_overflows(consumed_bytes, bytes))
|
||||||
die(_("pack too large for current definition of off_t"));
|
die(_("pack too large for current definition of off_t"));
|
||||||
consumed_bytes += bytes;
|
consumed_bytes += bytes;
|
||||||
if (max_input_size && consumed_bytes > max_input_size)
|
if (max_input_size && consumed_bytes > max_input_size) {
|
||||||
die(_("pack exceeds maximum allowed 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)
|
static const char *open_pack_file(const char *pack_name)
|
||||||
|
|
|
@ -284,4 +284,12 @@ test_expect_success 'index-pack -v --stdin produces progress for both phases' '
|
||||||
test_i18ngrep "Resolving deltas" err
|
test_i18ngrep "Resolving deltas" err
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'too-large packs report the breach' '
|
||||||
|
pack=$(git pack-objects --all pack </dev/null) &&
|
||||||
|
sz="$(test_file_size pack-$pack.pack)" &&
|
||||||
|
test "$sz" -gt 20 &&
|
||||||
|
test_must_fail git index-pack --max-input-size=20 pack-$pack.pack 2>err &&
|
||||||
|
grep "maximum allowed size (20 bytes)" err
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Загрузка…
Ссылка в новой задаче