All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matt Cooper via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, me@ttaylorr.com, derrickstolee@github.com,
	Matt Cooper <vtbassmatt@gmail.com>,
	Matt Cooper <vtbassmatt@gmail.com>
Subject: [PATCH 1/2] index-pack: clarify the breached limit
Date: Wed, 23 Feb 2022 16:03:12 +0000	[thread overview]
Message-ID: <a2eb3956f3e811a1d96618b94738ce862f2c6483.1645632193.git.gitgitgadget@gmail.com> (raw)
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


  reply	other threads:[~2022-02-23 16:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 16:03 [PATCH 0/2] Specify the actual pack size limit which is breached Matt Cooper via GitGitGadget
2022-02-23 16:03 ` Matt Cooper via GitGitGadget [this message]
2022-02-23 16:03 ` [PATCH 2/2] t5302: confirm that large packs mention limit Matt Cooper via GitGitGadget
2022-02-23 17:22   ` Taylor Blau
2022-02-23 23:26     ` Junio C Hamano
2022-02-23 23:41       ` Taylor Blau
2022-02-23 16:33 ` [PATCH 0/2] Specify the actual pack size limit which is breached Taylor Blau
2022-02-24  0:07 ` [PATCH v2] index-pack: clarify the breached limit Matt Cooper via GitGitGadget
2022-02-24  0:14   ` Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2eb3956f3e811a1d96618b94738ce862f2c6483.1645632193.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=vtbassmatt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.