From: "Joy Gundu via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Patrick Steinhardt>" <ps@pks.im>,
"Kristoffer Haugsbakk>" <kristofferhaugsbakk@fastmail.com>,
"Christian Couder>" <christian.couder@gmail.com>,
"Usman Akinyemi>" <usmanakinyemi202@gmail.com>,
Joie Joie <soniqjjj@gmail.com>, Joy <soniqjjj@gmail.com>,
Joy Gundu <soniqjjj@gmail.com>
Subject: [PATCH v2 2/2] config: move pack size limit into repo config
Date: Thu, 22 Oct 2026 09:47:12 +0000 [thread overview]
Message-ID: <05ae50b5daf0caea8666b0b7c8aaeb9f5c397017.1792662432.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2271.v2.git.1792662432.gitgitgadget@gmail.com>
From: Joy Gundu <soniqjjj@gmail.com>
The pack size limit is currently stored in a standalone global
variable, even though it is repository configuration.
Move the value into repo_config_values and update the configuration
parser and pack-writing code to read it from the repository's
configuration values.
This removes one piece of global configuration state and helps
make Git code easier to reuse as a library component.
Signed-off-by: Joy Gundu <soniqjjj@gmail.com>
---
builtin/pack-objects.c | 2 +-
environment.c | 3 +--
environment.h | 3 +--
object-file.c | 6 ++++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index ca3a891dfb..1bd6b2d566 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -5370,7 +5370,7 @@ int cmd_pack_objects(int argc,
if (!HAVE_THREADS && delta_search_threads != 1)
warning(_("no threads support, ignoring --threads"));
if (!pack_to_stdout && !pack_size_limit)
- pack_size_limit = pack_size_limit_cfg;
+ pack_size_limit = cfg->pack_size_limit;
if (pack_to_stdout && pack_size_limit)
die(_("--max-pack-size cannot be used to build a pack for transfer"));
if (pack_size_limit && pack_size_limit < 1024*1024) {
diff --git a/environment.c b/environment.c
index 89af09aa40..77bbbb7649 100644
--- a/environment.c
+++ b/environment.c
@@ -57,7 +57,6 @@ char *check_roundtrip_encoding;
#define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
#endif
int grafts_keep_true_parents;
-unsigned long pack_size_limit_cfg;
#ifndef PROTECT_HFS_DEFAULT
#define PROTECT_HFS_DEFAULT 0
@@ -728,7 +727,7 @@ int git_default_config(const char *var, const char *value,
}
if (!strcmp(var, "pack.packsizelimit")) {
- pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);
+ cfg->pack_size_limit = git_config_ulong(var, value, ctx->kvi);
return 0;
}
diff --git a/environment.h b/environment.h
index b336459e90..070314f7ef 100644
--- a/environment.h
+++ b/environment.h
@@ -132,6 +132,7 @@ struct repo_config_values {
int check_stat;
int zlib_compression_level;
int pack_compression_level;
+ unsigned long pack_size_limit;
int precomposed_unicode;
int core_sparse_checkout_cone;
int warn_on_object_refname_ambiguity;
@@ -235,8 +236,6 @@ int have_git_dir(void);
/* Environment bits from configuration mechanism */
extern int minimum_abbrev, default_abbrev;
extern int assume_unchanged;
-extern unsigned long pack_size_limit_cfg;
-
extern int grafts_keep_true_parents;
const char *get_log_output_encoding(void);
diff --git a/object-file.c b/object-file.c
index c049bf13f7..7f55e6331f 100644
--- a/object-file.c
+++ b/object-file.c
@@ -882,6 +882,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas
struct odb_transaction_files,
base);
struct transaction_packfile *state = &transaction->packfile;
+ struct repo_config_values *cfg =
+ repo_config_values(the_repository);
struct git_hash_ctx ctx;
unsigned char obuf[16384];
unsigned header_len;
@@ -903,8 +905,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas
* the difference between the inflated and on-disk size is limited
* to zlib compression and is sufficient for this check.
*/
- if (state->nr_written && pack_size_limit_cfg &&
- pack_size_limit_cfg < state->offset + stream->size) {
+ if (state->nr_written && cfg->pack_size_limit &&
+ cfg->pack_size_limit < state->offset + stream->size) {
flush_packfile_transaction(transaction);
odb_reprepare(transaction->base.source->odb);
}
--
gitgitgadget
next prev parent reply other threads:[~2026-10-22 9:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 18:56 [PATCH] config: move pack size limit into repo config Joy via GitGitGadget
2026-10-20 19:02 ` Kristoffer Haugsbakk
2026-10-21 8:09 ` Patrick Steinhardt
2026-10-21 12:23 ` Joie Joie
2026-10-22 9:47 ` [PATCH v2 0/2] " Joy via GitGitGadget
2026-10-22 9:47 ` [PATCH v2 1/2] repo: zero-initialize configuration values Joy Gundu via GitGitGadget
2026-10-22 11:30 ` Patrick Steinhardt
2026-10-23 12:00 ` Joie Joie
2026-10-26 7:30 ` Patrick Steinhardt
2026-10-22 9:47 ` Joy Gundu via GitGitGadget [this message]
2026-10-22 11:30 ` [PATCH v2 2/2] config: move pack size limit into repo config Patrick Steinhardt
2026-10-22 11:30 ` [PATCH v2 0/2] " Patrick Steinhardt
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=05ae50b5daf0caea8666b0b7c8aaeb9f5c397017.1792662432.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=ps@pks.im \
--cc=soniqjjj@gmail.com \
--cc=usmanakinyemi202@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox