git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] index-pack: clarify the breached limit

From
MGMatt Cooper via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 23, 2022, 16:03 UTC
Message-ID
<a2eb3956f3e811a1d96618b94738ce862f2c6483.1645632193.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1158.git.1645632193.gitgitgadget@gmail.com>
From: Matt Cooper <vtbassmatt@gmail.com>

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).

Signed-off-by: Matt Cooper <vtbassmatt@gmail.com>
---
 builtin/index-pack.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 3c2e6aee3cc..c45273de3b1 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -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)
-- 
gitgitgadget
Previous: Matt Cooper via GitGitGadgetNext: Matt Cooper via GitGitGadget
Message 2 of 9 in “Specify the actual pack size limit which is breached”
  1. 0/2 Specify the actual pack size limit which is breachedMatt Cooper via GitGitGadget, Feb 23, 2022
  2. 1/2 index-pack: clarify the breached limitMatt Cooper via GitGitGadget, Feb 23, 2022
  3. 2/2 t5302: confirm that large packs mention limitMatt Cooper via GitGitGadget, Feb 23, 2022
  4. Taylor BlauFeb 23, 2022
  5. Junio C HamanoFeb 23, 2022
  6. Taylor BlauFeb 23, 2022
  7. Taylor BlauFeb 23, 2022
  8. index-pack: clarify the breached limitMatt Cooper via GitGitGadget, Feb 24, 2022
  9. Ævar Arnfjörð BjarmasonFeb 24, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.