{"thread":{"id":"66607","subject":"[PATCH] config: move pack size limit into repo config","startedAt":"2026-10-20T18:56:27Z","lastAt":"2026-11-05T15:14:44Z","messageCount":16,"participants":["Joy via GitGitGadget","Kristoffer Haugsbakk","Patrick Steinhardt","Joie Joie","Joy Gundu via GitGitGadget","Tanga Joris"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"555607","messageId":"pull.2271.git.1792522587065.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":null,"subject":"[PATCH] config: move pack size limit into repo config","fromName":"Joy via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-20T18:56:27Z","receivedAt":"2026-10-20T18:56:27Z","isPatch":true,"sender":{"key":"cryptocurrencydiva@gmail.com","avatar":null},"body":"From: Joy Gundu <soniqjjj@gmail.com>\n\nStore the pack.packsizelimit value in repository configuration\nrather than keeping it in a standalone global variable for the repository.\n\nUpdate the configuration parser and pack-writing code to read\nthe value from repo_config_values rather than a global variable.\n\nThis change removes one piece of global configuration state from Git\nand helps make Git code easier to reuse as a library component.\n\nSigned-off-by: Joy Gundu <soniqjjj@gmail.com>\n---\n    config: move pack size limit into repo config\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2271%2FJoiejoie1%2Foutreachy%2Fglobal-state-mini-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2271/Joiejoie1/outreachy/global-state-mini-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2271\n\n builtin/pack-objects.c | 2 +-\n environment.c          | 4 ++--\n environment.h          | 3 +--\n object-file.c          | 6 ++++--\n 4 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex af9390a46b..1c9044060d 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -5380,7 +5380,7 @@ int cmd_pack_objects(int argc,\n \tif (!HAVE_THREADS && delta_search_threads != 1)\n \t\twarning(_(\"no threads support, ignoring --threads\"));\n \tif (!pack_to_stdout && !pack_size_limit)\n-\t\tpack_size_limit = pack_size_limit_cfg;\n+\t\tpack_size_limit = cfg->pack_size_limit;\n \tif (pack_to_stdout && pack_size_limit)\n \t\tdie(_(\"--max-pack-size cannot be used to build a pack for transfer\"));\n \tif (pack_size_limit && pack_size_limit < 1024*1024) {\ndiff --git a/environment.c b/environment.c\nindex c83cf44839..e350d6949e 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -57,7 +57,6 @@ char *check_roundtrip_encoding;\n #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS\n #endif\n int grafts_keep_true_parents;\n-unsigned long pack_size_limit_cfg;\n \n #ifndef PROTECT_HFS_DEFAULT\n #define PROTECT_HFS_DEFAULT 0\n@@ -728,7 +727,7 @@ int git_default_config(const char *var, const char *value,\n \t}\n \n \tif (!strcmp(var, \"pack.packsizelimit\")) {\n-\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n+\t\tcfg->pack_size_limit = git_config_ulong(var, value, ctx->kvi);\n \t\treturn 0;\n \t}\n \n@@ -768,6 +767,7 @@ void repo_config_values_init(struct repo_config_values *cfg)\n \tcfg->check_stat = 1;\n \tcfg->zlib_compression_level = Z_BEST_SPEED;\n \tcfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n+\tcfg->pack_size_limit = 0;\n \tcfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n \tcfg->core_sparse_checkout_cone = 0;\n \tcfg->warn_on_object_refname_ambiguity = 1;\ndiff --git a/environment.h b/environment.h\nindex b336459e90..070314f7ef 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -132,6 +132,7 @@ struct repo_config_values {\n \tint check_stat;\n \tint zlib_compression_level;\n \tint pack_compression_level;\n+\tunsigned long pack_size_limit;\n \tint precomposed_unicode;\n \tint core_sparse_checkout_cone;\n \tint warn_on_object_refname_ambiguity;\n@@ -235,8 +236,6 @@ int have_git_dir(void);\n /* Environment bits from configuration mechanism */\n extern int minimum_abbrev, default_abbrev;\n extern int assume_unchanged;\n-extern unsigned long pack_size_limit_cfg;\n-\n extern int grafts_keep_true_parents;\n \n const char *get_log_output_encoding(void);\ndiff --git a/object-file.c b/object-file.c\nindex 210984f825..3178bd6e65 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -885,6 +885,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas\n \t\t\t\t\t\t\t\t struct odb_transaction_files,\n \t\t\t\t\t\t\t\t base);\n \tstruct transaction_packfile *state = &transaction->packfile;\n+\tstruct repo_config_values *cfg =\n+\t\trepo_config_values(the_repository);\n \tstruct git_hash_ctx ctx;\n \tunsigned char obuf[16384];\n \tunsigned header_len;\n@@ -906,8 +908,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas\n \t * the difference between the inflated and on-disk size is limited\n \t * to zlib compression and is sufficient for this check.\n \t */\n-\tif (state->nr_written && pack_size_limit_cfg &&\n-\t    pack_size_limit_cfg < state->offset + stream->size) {\n+\tif (state->nr_written && cfg->pack_size_limit &&\n+\t    cfg->pack_size_limit < state->offset + stream->size) {\n \t\tflush_packfile_transaction(transaction);\n \t\todb_reprepare(transaction->base.source->odb);\n \t}\n\nbase-commit: c51408889c3b372814bc20b9431c3b74d0d268eb\n-- \ngitgitgadget\n\n"},{"id":"555608","messageId":"922955e1-8fe3-4e1f-8f5a-4ecdd61b1411@app.fastmail.com","threadId":"66607","inReplyTo":"pull.2271.git.1792522587065.gitgitgadget@gmail.com","subject":"Re: [PATCH] config: move pack size limit into repo config","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2026-10-20T19:02:22Z","receivedAt":"2026-10-20T19:02:22Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Tue, Oct 20, 2026, at 20:56, Joy via GitGitGadget wrote:\n> From: Joy Gundu <soniqjjj@gmail.com>\n>\n> [...]\n>\n> This change removes one piece of global configuration state from Git\n> and helps make Git code easier to reuse as a library component.\n\nIt's nice to see a paragraph explaining the\noverall project in plain terms. Not just\n\"we are getting rid of globals\" or \"this is\nlibification\".\n\n>\n> Signed-off-by: Joy Gundu <soniqjjj@gmail.com>\n> [...]\n\nSent from mobile\n\n"},{"id":"555694","messageId":"athzKcUyQjqUTKzZ@pks.im","threadId":"66607","inReplyTo":"pull.2271.git.1792522587065.gitgitgadget@gmail.com","subject":"Re: [PATCH] config: move pack size limit into repo config","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-21T08:09:13Z","receivedAt":"2026-10-21T08:09:13Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Oct 20, 2026 at 06:56:27PM +0000, Joy via GitGitGadget wrote:\n> From: Joy Gundu <soniqjjj@gmail.com>\n> \n> Store the pack.packsizelimit value in repository configuration\n> rather than keeping it in a standalone global variable for the repository.\n> \n> Update the configuration parser and pack-writing code to read\n> the value from repo_config_values rather than a global variable.\n> \n> This change removes one piece of global configuration state from Git\n> and helps make Git code easier to reuse as a library component.\n\nThe commit message typically starts with an observation, followed by an\nexplanation what's bad about the observed status quo and then finally\nexplains how that state is improved. The order you have here does not\nmatch that typical flow.\n\n> diff --git a/environment.c b/environment.c\n> index c83cf44839..e350d6949e 100644\n> --- a/environment.c\n> +++ b/environment.c\n> @@ -728,7 +727,7 @@ int git_default_config(const char *var, const char *value,\n>  \t}\n>  \n>  \tif (!strcmp(var, \"pack.packsizelimit\")) {\n> -\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n> +\t\tcfg->pack_size_limit = git_config_ulong(var, value, ctx->kvi);\n>  \t\treturn 0;\n>  \t}\n>  \n> @@ -768,6 +767,7 @@ void repo_config_values_init(struct repo_config_values *cfg)\n>  \tcfg->check_stat = 1;\n>  \tcfg->zlib_compression_level = Z_BEST_SPEED;\n>  \tcfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n> +\tcfg->pack_size_limit = 0;\n>  \tcfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n>  \tcfg->core_sparse_checkout_cone = 0;\n>  \tcfg->warn_on_object_refname_ambiguity = 1;\n\nHmm, quite annoying that we need to explicitly zero out all these\nfields. Maybe we should adapt `repo_config_values_init()` to first\n`memset(cfg, 0, sizeof(*cfg))`? That would allow us to remove a lot of\nassignments. If you want to do that, it would be great to do it as a\npreparatory patch in the same series.\n\nOther than that the diff looks exactly the same as a local patch I had\nalready written myself, so thanks for allowing me to worry about one\nless thing :)\n\nPatrick\n\n"},{"id":"555727","messageId":"CAH=d44dU8w+oVc=VEH_84afYsTua2YEVkYEcqHQ9npckymzo6g@mail.gmail.com","threadId":"66607","inReplyTo":"athzKcUyQjqUTKzZ@pks.im","subject":"Re: [PATCH] config: move pack size limit into repo config","fromName":"Joie Joie","fromEmail":"soniqjjj@gmail.com","sentAt":"2026-10-21T12:23:55Z","receivedAt":"2026-10-21T12:23:55Z","isPatch":true,"sender":{"key":"soniqjjj@gmail.com","avatar":null},"body":"Hi Patrick,\n\nThanks for the feedback! I’ll take a closer look at zero-initializing\nrepo_config_values and see if it makes sense to include it as a\npreparatory patch.\n\nI’ll also keep your advice on commit message structure in mind for\nfuture patches.\n\nThanks again for taking the time to review my work!\n\nBest,\nJoy\n\n\nOn Wed, Oct 21, 2026 at 9:09 AM Patrick Steinhardt <ps@pks.im> wrote:\n>\n> On Tue, Oct 20, 2026 at 06:56:27PM +0000, Joy via GitGitGadget wrote:\n> > From: Joy Gundu <soniqjjj@gmail.com>\n> >\n> > Store the pack.packsizelimit value in repository configuration\n> > rather than keeping it in a standalone global variable for the repository.\n> >\n> > Update the configuration parser and pack-writing code to read\n> > the value from repo_config_values rather than a global variable.\n> >\n> > This change removes one piece of global configuration state from Git\n> > and helps make Git code easier to reuse as a library component.\n>\n> The commit message typically starts with an observation, followed by an\n> explanation what's bad about the observed status quo and then finally\n> explains how that state is improved. The order you have here does not\n> match that typical flow.\n>\n> > diff --git a/environment.c b/environment.c\n> > index c83cf44839..e350d6949e 100644\n> > --- a/environment.c\n> > +++ b/environment.c\n> > @@ -728,7 +727,7 @@ int git_default_config(const char *var, const char *value,\n> >       }\n> >\n> >       if (!strcmp(var, \"pack.packsizelimit\")) {\n> > -             pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n> > +             cfg->pack_size_limit = git_config_ulong(var, value, ctx->kvi);\n> >               return 0;\n> >       }\n> >\n> > @@ -768,6 +767,7 @@ void repo_config_values_init(struct repo_config_values *cfg)\n> >       cfg->check_stat = 1;\n> >       cfg->zlib_compression_level = Z_BEST_SPEED;\n> >       cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n> > +     cfg->pack_size_limit = 0;\n> >       cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n> >       cfg->core_sparse_checkout_cone = 0;\n> >       cfg->warn_on_object_refname_ambiguity = 1;\n>\n> Hmm, quite annoying that we need to explicitly zero out all these\n> fields. Maybe we should adapt `repo_config_values_init()` to first\n> `memset(cfg, 0, sizeof(*cfg))`? That would allow us to remove a lot of\n> assignments. If you want to do that, it would be great to do it as a\n> preparatory patch in the same series.\n>\n> Other than that the diff looks exactly the same as a local patch I had\n> already written myself, so thanks for allowing me to worry about one\n> less thing :)\n>\n> Patrick\n\n"},{"id":"555837","messageId":"pull.2271.v2.git.1792662432.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":"pull.2271.git.1792522587065.gitgitgadget@gmail.com","subject":"[PATCH v2 0/2] config: move pack size limit into repo config","fromName":"Joy via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-22T09:47:10Z","receivedAt":"2026-10-22T09:47:10Z","isPatch":true,"sender":{"key":"cryptocurrencydiva@gmail.com","avatar":null},"body":"This series moves pack.packsizelimit from a standalone global variable into\nstruct repo_config_values, as part of the ongoing effort to reduce Git's\nreliance on global state and make its code easier to reuse as a library.\n\nThe series includes two patches:\n\n 1. Update repo_config_values_init() to use memset() for\n    zero-initialization, while keeping the defaults that require explicit\n    values.\n 2. Move the pack size limit into repo_config_values and update the relevant\n    code to read it from there.\n\n\nChanges since v1\n================\n\nThanks to Patrick Steinhardt for reviewing the first version and suggesting\nthe initialization cleanup.\n\nFollowing his feedback, I've:\n\n * Added a preparatory patch to simplify how repository configuration values\n   are initialized.\n * Reworked the main commit message to explain the existing problem before\n   describing the change.\n * Removed the need to explicitly initialize the new pack size limit field\n   to zero.\n\n\nTesting\n=======\n\nI built Git and ran the relevant configuration and pack-object tests:\n\n * make -j2 — passed.\n * t1300-config.sh — 518 successful tests.\n * t5300-pack-object.sh — 63 passed, 2 skipped, 0 failed.\n\nBoth test runs reported permission errors during cleanup after the tests had\ncompleted.\n\nJoy Gundu (2):\n  repo: zero-initialize configuration values\n  config: move pack size limit into repo config\n\n builtin/pack-objects.c |  2 +-\n environment.c          | 17 +++--------------\n environment.h          |  3 +--\n object-file.c          |  6 ++++--\n 4 files changed, 9 insertions(+), 19 deletions(-)\n\n\nbase-commit: 47fdf2208c5b94c8cc01c106b8f7c85efb91c926\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2271%2FJoiejoie1%2Foutreachy%2Fglobal-state-mini-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2271/Joiejoie1/outreachy/global-state-mini-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/2271\n\nRange-diff vs v1:\n\n -:  ---------- > 1:  df93a2a86c repo: zero-initialize configuration values\n 1:  e3e36c3459 ! 2:  05ae50b5da config: move pack size limit into repo config\n     @@ Metadata\n       ## Commit message ##\n          config: move pack size limit into repo config\n      \n     -    Store the pack.packsizelimit value in repository configuration\n     -    rather than keeping it in a standalone global variable for the repository.\n     +    The pack size limit is currently stored in a standalone global\n     +    variable, even though it is repository configuration.\n      \n     -    Update the configuration parser and pack-writing code to read\n     -    the value from repo_config_values rather than a global variable.\n     +    Move the value into repo_config_values and update the configuration\n     +    parser and pack-writing code to read it from the repository's\n     +    configuration values.\n      \n     -    This change removes one piece of global configuration state from Git\n     -    and helps make Git code easier to reuse as a library component.\n     +    This removes one piece of global configuration state and helps\n     +    make Git code easier to reuse as a library component.\n      \n          Signed-off-by: Joy Gundu <soniqjjj@gmail.com>\n      \n     @@ environment.c: int git_default_config(const char *var, const char *value,\n       \t\treturn 0;\n       \t}\n       \n     -@@ environment.c: void repo_config_values_init(struct repo_config_values *cfg)\n     - \tcfg->check_stat = 1;\n     - \tcfg->zlib_compression_level = Z_BEST_SPEED;\n     - \tcfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n     -+\tcfg->pack_size_limit = 0;\n     - \tcfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n     - \tcfg->core_sparse_checkout_cone = 0;\n     - \tcfg->warn_on_object_refname_ambiguity = 1;\n      \n       ## environment.h ##\n      @@ environment.h: struct repo_config_values {\n\n-- \ngitgitgadget\n\n"},{"id":"555838","messageId":"df93a2a86cae7d342270c0ee67a1c0d41ada202e.1792662432.git.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":"pull.2271.v2.git.1792662432.gitgitgadget@gmail.com","subject":"[PATCH v2 1/2] repo: zero-initialize configuration values","fromName":"Joy Gundu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-22T09:47:11Z","receivedAt":"2026-10-22T09:47:11Z","isPatch":true,"sender":{"key":"name:Joy Gundu","avatar":null},"body":"From: Joy Gundu <soniqjjj@gmail.com>\n\nSigned-off-by: Joy Gundu <soniqjjj@gmail.com>\n---\n environment.c | 14 ++------------\n 1 file changed, 2 insertions(+), 12 deletions(-)\n\ndiff --git a/environment.c b/environment.c\nindex c83cf44839..89af09aa40 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -752,34 +752,24 @@ int git_default_config(const char *var, const char *value,\n \n void repo_config_values_init(struct repo_config_values *cfg)\n {\n+\tmemset(cfg, 0, sizeof(*cfg));\n+\n \t/* section \"core\" config values */\n-\tcfg->attributes_file = NULL;\n-\tcfg->excludes_file = NULL;\n-\tcfg->editor_program = NULL;\n-\tcfg->pager_program = NULL;\n-\tcfg->askpass_program = NULL;\n-\tcfg->apply_default_whitespace = NULL;\n-\tcfg->apply_default_ignorewhitespace = NULL;\n \tcfg->push_default = PUSH_DEFAULT_UNSPECIFIED;\n \tcfg->autorebase = AUTOREBASE_NEVER;\n \tcfg->object_creation_mode = OBJECT_CREATION_MODE;\n-\tcfg->apply_sparse_checkout = 0;\n \tcfg->trust_ctime = 1;\n \tcfg->check_stat = 1;\n \tcfg->zlib_compression_level = Z_BEST_SPEED;\n \tcfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n \tcfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n-\tcfg->core_sparse_checkout_cone = 0;\n \tcfg->warn_on_object_refname_ambiguity = 1;\n \tcfg->protect_hfs = PROTECT_HFS_DEFAULT;\n \tcfg->protect_ntfs = PROTECT_NTFS_DEFAULT;\n-\tcfg->ignore_case = 0;\n \tcfg->trust_executable_bit = 1;\n \tcfg->has_symlinks = platform_has_symlinks();\n-\tcfg->use_nanosec = 0;\n \n \t/* section \"sparse\" config values */\n-\tcfg->sparse_expect_files_outside_of_patterns = 0;\n \n \t/* section \"branch\" config values */\n \tcfg->branch_track = BRANCH_TRACK_REMOTE;\n-- \ngitgitgadget\n\n\n"},{"id":"555839","messageId":"05ae50b5daf0caea8666b0b7c8aaeb9f5c397017.1792662432.git.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":"pull.2271.v2.git.1792662432.gitgitgadget@gmail.com","subject":"[PATCH v2 2/2] config: move pack size limit into repo config","fromName":"Joy Gundu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-22T09:47:12Z","receivedAt":"2026-10-22T09:47:12Z","isPatch":true,"sender":{"key":"name:Joy Gundu","avatar":null},"body":"From: Joy Gundu <soniqjjj@gmail.com>\n\nThe pack size limit is currently stored in a standalone global\nvariable, even though it is repository configuration.\n\nMove the value into repo_config_values and update the configuration\nparser and pack-writing code to read it from the repository's\nconfiguration values.\n\nThis removes one piece of global configuration state and helps\nmake Git code easier to reuse as a library component.\n\nSigned-off-by: Joy Gundu <soniqjjj@gmail.com>\n---\n builtin/pack-objects.c | 2 +-\n environment.c          | 3 +--\n environment.h          | 3 +--\n object-file.c          | 6 ++++--\n 4 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex ca3a891dfb..1bd6b2d566 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -5370,7 +5370,7 @@ int cmd_pack_objects(int argc,\n \tif (!HAVE_THREADS && delta_search_threads != 1)\n \t\twarning(_(\"no threads support, ignoring --threads\"));\n \tif (!pack_to_stdout && !pack_size_limit)\n-\t\tpack_size_limit = pack_size_limit_cfg;\n+\t\tpack_size_limit = cfg->pack_size_limit;\n \tif (pack_to_stdout && pack_size_limit)\n \t\tdie(_(\"--max-pack-size cannot be used to build a pack for transfer\"));\n \tif (pack_size_limit && pack_size_limit < 1024*1024) {\ndiff --git a/environment.c b/environment.c\nindex 89af09aa40..77bbbb7649 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -57,7 +57,6 @@ char *check_roundtrip_encoding;\n #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS\n #endif\n int grafts_keep_true_parents;\n-unsigned long pack_size_limit_cfg;\n \n #ifndef PROTECT_HFS_DEFAULT\n #define PROTECT_HFS_DEFAULT 0\n@@ -728,7 +727,7 @@ int git_default_config(const char *var, const char *value,\n \t}\n \n \tif (!strcmp(var, \"pack.packsizelimit\")) {\n-\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n+\t\tcfg->pack_size_limit = git_config_ulong(var, value, ctx->kvi);\n \t\treturn 0;\n \t}\n \ndiff --git a/environment.h b/environment.h\nindex b336459e90..070314f7ef 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -132,6 +132,7 @@ struct repo_config_values {\n \tint check_stat;\n \tint zlib_compression_level;\n \tint pack_compression_level;\n+\tunsigned long pack_size_limit;\n \tint precomposed_unicode;\n \tint core_sparse_checkout_cone;\n \tint warn_on_object_refname_ambiguity;\n@@ -235,8 +236,6 @@ int have_git_dir(void);\n /* Environment bits from configuration mechanism */\n extern int minimum_abbrev, default_abbrev;\n extern int assume_unchanged;\n-extern unsigned long pack_size_limit_cfg;\n-\n extern int grafts_keep_true_parents;\n \n const char *get_log_output_encoding(void);\ndiff --git a/object-file.c b/object-file.c\nindex c049bf13f7..7f55e6331f 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -882,6 +882,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas\n \t\t\t\t\t\t\t\t struct odb_transaction_files,\n \t\t\t\t\t\t\t\t base);\n \tstruct transaction_packfile *state = &transaction->packfile;\n+\tstruct repo_config_values *cfg =\n+\t\trepo_config_values(the_repository);\n \tstruct git_hash_ctx ctx;\n \tunsigned char obuf[16384];\n \tunsigned header_len;\n@@ -903,8 +905,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas\n \t * the difference between the inflated and on-disk size is limited\n \t * to zlib compression and is sufficient for this check.\n \t */\n-\tif (state->nr_written && pack_size_limit_cfg &&\n-\t    pack_size_limit_cfg < state->offset + stream->size) {\n+\tif (state->nr_written && cfg->pack_size_limit &&\n+\t    cfg->pack_size_limit < state->offset + stream->size) {\n \t\tflush_packfile_transaction(transaction);\n \t\todb_reprepare(transaction->base.source->odb);\n \t}\n-- \ngitgitgadget\n\n"},{"id":"555855","messageId":"atnz1HFcA8q8IuE_@pks.im","threadId":"66607","inReplyTo":"df93a2a86cae7d342270c0ee67a1c0d41ada202e.1792662432.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 1/2] repo: zero-initialize configuration values","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-22T11:30:28Z","receivedAt":"2026-10-22T11:30:28Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Oct 22, 2026 at 09:47:11AM +0000, Joy Gundu via GitGitGadget wrote:\n> From: Joy Gundu <soniqjjj@gmail.com>\n\nEven though the patch speaks for itself, we typically still like to a\nsentence or two in the commit message itself. E.g.:\n\n    When initializing `struct repo_config_values` we manually zero out a\n    lot of its members, which is tedious. Reduce the boilerplate by first\n    zeroing out the whole structure so that we only have to set those\n    members that have a non-zero default value.\n\n> Signed-off-by: Joy Gundu <soniqjjj@gmail.com>\n> ---\n>  environment.c | 14 ++------------\n>  1 file changed, 2 insertions(+), 12 deletions(-)\n> \n> diff --git a/environment.c b/environment.c\n> index c83cf44839..89af09aa40 100644\n> --- a/environment.c\n> +++ b/environment.c\n> @@ -752,34 +752,24 @@ int git_default_config(const char *var, const char *value,\n>  \n>  void repo_config_values_init(struct repo_config_values *cfg)\n>  {\n> +\tmemset(cfg, 0, sizeof(*cfg));\n> +\n>  \t/* section \"core\" config values */\n> -\tcfg->attributes_file = NULL;\n> -\tcfg->excludes_file = NULL;\n> -\tcfg->editor_program = NULL;\n> -\tcfg->pager_program = NULL;\n> -\tcfg->askpass_program = NULL;\n> -\tcfg->apply_default_whitespace = NULL;\n> -\tcfg->apply_default_ignorewhitespace = NULL;\n>  \tcfg->push_default = PUSH_DEFAULT_UNSPECIFIED;\n>  \tcfg->autorebase = AUTOREBASE_NEVER;\n>  \tcfg->object_creation_mode = OBJECT_CREATION_MODE;\n> -\tcfg->apply_sparse_checkout = 0;\n>  \tcfg->trust_ctime = 1;\n>  \tcfg->check_stat = 1;\n>  \tcfg->zlib_compression_level = Z_BEST_SPEED;\n>  \tcfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n>  \tcfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n> -\tcfg->core_sparse_checkout_cone = 0;\n>  \tcfg->warn_on_object_refname_ambiguity = 1;\n>  \tcfg->protect_hfs = PROTECT_HFS_DEFAULT;\n>  \tcfg->protect_ntfs = PROTECT_NTFS_DEFAULT;\n> -\tcfg->ignore_case = 0;\n>  \tcfg->trust_executable_bit = 1;\n>  \tcfg->has_symlinks = platform_has_symlinks();\n> -\tcfg->use_nanosec = 0;\n>  \n>  \t/* section \"sparse\" config values */\n> -\tcfg->sparse_expect_files_outside_of_patterns = 0;\n\nWe should probably drop this comment together with the code.\n\n>  \t/* section \"branch\" config values */\n>  \tcfg->branch_track = BRANCH_TRACK_REMOTE;\n\nOther than that this looks good to me.\n\nPatrick\n\n"},{"id":"555856","messageId":"atnz2koLCp6FMD0u@pks.im","threadId":"66607","inReplyTo":"05ae50b5daf0caea8666b0b7c8aaeb9f5c397017.1792662432.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 2/2] config: move pack size limit into repo config","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-22T11:30:34Z","receivedAt":"2026-10-22T11:30:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Oct 22, 2026 at 09:47:12AM +0000, Joy Gundu via GitGitGadget wrote:\n> From: Joy Gundu <soniqjjj@gmail.com>\n> \n> The pack size limit is currently stored in a standalone global\n> variable, even though it is repository configuration.\n> \n> Move the value into repo_config_values and update the configuration\n> parser and pack-writing code to read it from the repository's\n> configuration values.\n> \n> This removes one piece of global configuration state and helps\n> make Git code easier to reuse as a library component.\n\nThis reads well to me, thanks.\n\nPatrick\n\n"},{"id":"555857","messageId":"atnz38iLy6_wotH9@pks.im","threadId":"66607","inReplyTo":"pull.2271.v2.git.1792662432.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 0/2] config: move pack size limit into repo config","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-22T11:30:39Z","receivedAt":"2026-10-22T11:30:39Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Oct 22, 2026 at 09:47:10AM +0000, Joy via GitGitGadget wrote:\n> Changes since v1\n> ================\n> \n> Thanks to Patrick Steinhardt for reviewing the first version and suggesting\n> the initialization cleanup.\n> \n> Following his feedback, I've:\n> \n>  * Added a preparatory patch to simplify how repository configuration values\n>    are initialized.\n>  * Reworked the main commit message to explain the existing problem before\n>    describing the change.\n>  * Removed the need to explicitly initialize the new pack size limit field\n>    to zero.\n\nI've got two more small nits on the first patch that you probably want\nto address, but other than that this looks as expected to me. Thanks!\n\nPatrick\n\n"},{"id":"555994","messageId":"CAH=d44czyUb3Kam8oEfdqY0ROO4636XN5NuuQ0gn+wHUe9xETw@mail.gmail.com","threadId":"66607","inReplyTo":"atnz1HFcA8q8IuE_@pks.im","subject":"Re: [PATCH v2 1/2] repo: zero-initialize configuration values","fromName":"Joie Joie","fromEmail":"soniqjjj@gmail.com","sentAt":"2026-10-23T12:00:48Z","receivedAt":"2026-10-23T12:00:48Z","isPatch":true,"sender":{"key":"soniqjjj@gmail.com","avatar":null},"body":"Hi Patrick,\n\nThanks for the review and the suggested wording. I'll add an\nexplanation to the commit message and remove the now-unnecessary\ncomment.\n\nI'll include both changes in the next version of the series.\n\nThanks again,\nJoy\n\nOn Thu, Oct 22, 2026 at 12:30 PM Patrick Steinhardt <ps@pks.im> wrote:\n>\n> On Thu, Oct 22, 2026 at 09:47:11AM +0000, Joy Gundu via GitGitGadget wrote:\n> > From: Joy Gundu <soniqjjj@gmail.com>\n>\n> Even though the patch speaks for itself, we typically still like to a\n> sentence or two in the commit message itself. E.g.:\n>\n>     When initializing `struct repo_config_values` we manually zero out a\n>     lot of its members, which is tedious. Reduce the boilerplate by first\n>     zeroing out the whole structure so that we only have to set those\n>     members that have a non-zero default value.\n>\n> > Signed-off-by: Joy Gundu <soniqjjj@gmail.com>\n> > ---\n> >  environment.c | 14 ++------------\n> >  1 file changed, 2 insertions(+), 12 deletions(-)\n> >\n> > diff --git a/environment.c b/environment.c\n> > index c83cf44839..89af09aa40 100644\n> > --- a/environment.c\n> > +++ b/environment.c\n> > @@ -752,34 +752,24 @@ int git_default_config(const char *var, const char *value,\n> >\n> >  void repo_config_values_init(struct repo_config_values *cfg)\n> >  {\n> > +     memset(cfg, 0, sizeof(*cfg));\n> > +\n> >       /* section \"core\" config values */\n> > -     cfg->attributes_file = NULL;\n> > -     cfg->excludes_file = NULL;\n> > -     cfg->editor_program = NULL;\n> > -     cfg->pager_program = NULL;\n> > -     cfg->askpass_program = NULL;\n> > -     cfg->apply_default_whitespace = NULL;\n> > -     cfg->apply_default_ignorewhitespace = NULL;\n> >       cfg->push_default = PUSH_DEFAULT_UNSPECIFIED;\n> >       cfg->autorebase = AUTOREBASE_NEVER;\n> >       cfg->object_creation_mode = OBJECT_CREATION_MODE;\n> > -     cfg->apply_sparse_checkout = 0;\n> >       cfg->trust_ctime = 1;\n> >       cfg->check_stat = 1;\n> >       cfg->zlib_compression_level = Z_BEST_SPEED;\n> >       cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n> >       cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n> > -     cfg->core_sparse_checkout_cone = 0;\n> >       cfg->warn_on_object_refname_ambiguity = 1;\n> >       cfg->protect_hfs = PROTECT_HFS_DEFAULT;\n> >       cfg->protect_ntfs = PROTECT_NTFS_DEFAULT;\n> > -     cfg->ignore_case = 0;\n> >       cfg->trust_executable_bit = 1;\n> >       cfg->has_symlinks = platform_has_symlinks();\n> > -     cfg->use_nanosec = 0;\n> >\n> >       /* section \"sparse\" config values */\n> > -     cfg->sparse_expect_files_outside_of_patterns = 0;\n>\n> We should probably drop this comment together with the code.\n>\n> >       /* section \"branch\" config values */\n> >       cfg->branch_track = BRANCH_TRACK_REMOTE;\n>\n> Other than that this looks good to me.\n>\n> Patrick\n\n"},{"id":"556259","messageId":"at8BnkKqRSa0fUoO@pks.im","threadId":"66607","inReplyTo":"CAH=d44czyUb3Kam8oEfdqY0ROO4636XN5NuuQ0gn+wHUe9xETw@mail.gmail.com","subject":"Re: [PATCH v2 1/2] repo: zero-initialize configuration values","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-26T07:30:38Z","receivedAt":"2026-10-26T07:30:38Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi Joy,\n\nOn Fri, Oct 23, 2026 at 01:00:48PM +0100, Joie Joie wrote:\n> Hi Patrick,\n> \n> Thanks for the review and the suggested wording. I'll add an\n> explanation to the commit message and remove the now-unnecessary\n> comment.\n> \n> I'll include both changes in the next version of the series.\n\nThanks.\n\nOne note though: we don't top-post over here, but instead write our\nreplies below the parts that we're replying to (like I do here).\n\nPatrick\n\n"},{"id":"557311","messageId":"pull.2271.v3.git.1793710118.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":"pull.2271.git.1792522587065.gitgitgadget@gmail.com","subject":"[PATCH v3 0/2] [Outreachy] config: move pack size limit into repo config","fromName":"Joy via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-11-03T12:48:36Z","receivedAt":"2026-11-03T12:48:36Z","isPatch":true,"sender":{"key":"cryptocurrencydiva@gmail.com","avatar":null},"body":"This series moves pack.packsizelimit from a standalone global variable into\nstruct repo_config_values, as part of the ongoing effort to reduce Git's\nreliance on global state and make its code easier to reuse as a library.\n\nThe series includes two patches:\n\n 1. Update repo_config_values_init() to use memset() for\n    zero-initialization, while keeping the defaults that require explicit\n    values.\n 2. Move the pack size limit into repo_config_values and update the relevant\n    code to read it from there.\n\n\nChanges since v1\n================\n\nThanks to Patrick Steinhardt for reviewing the first version and suggesting\nthe initialization cleanup.\n\nFollowing his feedback, I've:\n\n * Added a preparatory patch to simplify how repository configuration values\n   are initialized.\n * Reworked the main commit message to explain the existing problem before\n   describing the change.\n * Removed the need to explicitly initialize the new pack size limit field\n   to zero.\n\n\nTesting\n=======\n\nI built Git and ran the relevant configuration and pack-object tests:\n\n * make -j2 — passed.\n * t1300-config.sh — 518 successful tests.\n * t5300-pack-object.sh — 63 passed, 2 skipped, 0 failed.\n\nBoth test runs reported permission errors during cleanup after the tests had\ncompleted.\n\nJoy Gundu (2):\n  repo: zero-initialize configuration values\n  config: move pack size limit into repo config\n\n builtin/pack-objects.c |  2 +-\n environment.c          | 19 +++----------------\n environment.h          |  3 +--\n object-file.c          |  6 ++++--\n 4 files changed, 9 insertions(+), 21 deletions(-)\n\n\nbase-commit: 47fdf2208c5b94c8cc01c106b8f7c85efb91c926\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2271%2FJoiejoie1%2Foutreachy%2Fglobal-state-mini-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2271/Joiejoie1/outreachy/global-state-mini-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/2271\n\nRange-diff vs v2:\n\n 1:  df93a2a86c ! 1:  dc18b66976 repo: zero-initialize configuration values\n     @@ Metadata\n       ## Commit message ##\n          repo: zero-initialize configuration values\n      \n     +    When initializing struct repo_config_values, we explicitly initialize\n     +    several members to zero or NULL. This adds unnecessary boilerplate as\n     +    more configuration values are added to the structure.\n     +\n     +    Zero-initialize the entire structure with memset() instead, leaving\n     +    only members with non-zero defaults to be initialized individually.\n     +\n          Signed-off-by: Joy Gundu <soniqjjj@gmail.com>\n      \n       ## environment.c ##\n     @@ environment.c: int git_default_config(const char *var, const char *value,\n       \tcfg->has_symlinks = platform_has_symlinks();\n      -\tcfg->use_nanosec = 0;\n       \n     - \t/* section \"sparse\" config values */\n     +-\t/* section \"sparse\" config values */\n      -\tcfg->sparse_expect_files_outside_of_patterns = 0;\n       \n       \t/* section \"branch\" config values */\n 2:  05ae50b5da ! 2:  ba34e82a0a config: move pack size limit into repo config\n     @@ environment.c: int git_default_config(const char *var, const char *value,\n       \t\treturn 0;\n       \t}\n       \n     +@@ environment.c: void repo_config_values_init(struct repo_config_values *cfg)\n     + \tcfg->trust_executable_bit = 1;\n     + \tcfg->has_symlinks = platform_has_symlinks();\n     + \n     +-\n     + \t/* section \"branch\" config values */\n     + \tcfg->branch_track = BRANCH_TRACK_REMOTE;\n     + }\n      \n       ## environment.h ##\n      @@ environment.h: struct repo_config_values {\n\n-- \ngitgitgadget\n\n"},{"id":"557312","messageId":"dc18b66976f681292e8539b68319393083554650.1793710118.git.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":"pull.2271.v3.git.1793710118.gitgitgadget@gmail.com","subject":"[PATCH v3 1/2] repo: zero-initialize configuration values","fromName":"Joy Gundu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-11-03T12:48:37Z","receivedAt":"2026-11-03T12:48:37Z","isPatch":true,"sender":{"key":"name:Joy Gundu","avatar":null},"body":"From: Joy Gundu <soniqjjj@gmail.com>\n\nWhen initializing struct repo_config_values, we explicitly initialize\nseveral members to zero or NULL. This adds unnecessary boilerplate as\nmore configuration values are added to the structure.\n\nZero-initialize the entire structure with memset() instead, leaving\nonly members with non-zero defaults to be initialized individually.\n\nSigned-off-by: Joy Gundu <soniqjjj@gmail.com>\n---\n environment.c | 15 ++-------------\n 1 file changed, 2 insertions(+), 13 deletions(-)\n\ndiff --git a/environment.c b/environment.c\nindex c83cf44839..5a2eb8b2e4 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -752,34 +752,23 @@ int git_default_config(const char *var, const char *value,\n \n void repo_config_values_init(struct repo_config_values *cfg)\n {\n+\tmemset(cfg, 0, sizeof(*cfg));\n+\n \t/* section \"core\" config values */\n-\tcfg->attributes_file = NULL;\n-\tcfg->excludes_file = NULL;\n-\tcfg->editor_program = NULL;\n-\tcfg->pager_program = NULL;\n-\tcfg->askpass_program = NULL;\n-\tcfg->apply_default_whitespace = NULL;\n-\tcfg->apply_default_ignorewhitespace = NULL;\n \tcfg->push_default = PUSH_DEFAULT_UNSPECIFIED;\n \tcfg->autorebase = AUTOREBASE_NEVER;\n \tcfg->object_creation_mode = OBJECT_CREATION_MODE;\n-\tcfg->apply_sparse_checkout = 0;\n \tcfg->trust_ctime = 1;\n \tcfg->check_stat = 1;\n \tcfg->zlib_compression_level = Z_BEST_SPEED;\n \tcfg->pack_compression_level = Z_DEFAULT_COMPRESSION;\n \tcfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */\n-\tcfg->core_sparse_checkout_cone = 0;\n \tcfg->warn_on_object_refname_ambiguity = 1;\n \tcfg->protect_hfs = PROTECT_HFS_DEFAULT;\n \tcfg->protect_ntfs = PROTECT_NTFS_DEFAULT;\n-\tcfg->ignore_case = 0;\n \tcfg->trust_executable_bit = 1;\n \tcfg->has_symlinks = platform_has_symlinks();\n-\tcfg->use_nanosec = 0;\n \n-\t/* section \"sparse\" config values */\n-\tcfg->sparse_expect_files_outside_of_patterns = 0;\n \n \t/* section \"branch\" config values */\n \tcfg->branch_track = BRANCH_TRACK_REMOTE;\n-- \ngitgitgadget\n\n\n"},{"id":"557313","messageId":"ba34e82a0a6a99181637e2fe33be5506f2a1bdd0.1793710118.git.gitgitgadget@gmail.com","threadId":"66607","inReplyTo":"pull.2271.v3.git.1793710118.gitgitgadget@gmail.com","subject":"[PATCH v3 2/2] config: move pack size limit into repo config","fromName":"Joy Gundu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-11-03T12:48:38Z","receivedAt":"2026-11-03T12:48:38Z","isPatch":true,"sender":{"key":"name:Joy Gundu","avatar":null},"body":"From: Joy Gundu <soniqjjj@gmail.com>\n\nThe pack size limit is currently stored in a standalone global\nvariable, even though it is repository configuration.\n\nMove the value into repo_config_values and update the configuration\nparser and pack-writing code to read it from the repository's\nconfiguration values.\n\nThis removes one piece of global configuration state and helps\nmake Git code easier to reuse as a library component.\n\nSigned-off-by: Joy Gundu <soniqjjj@gmail.com>\n---\n builtin/pack-objects.c | 2 +-\n environment.c          | 4 +---\n environment.h          | 3 +--\n object-file.c          | 6 ++++--\n 4 files changed, 7 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex ca3a891dfb..1bd6b2d566 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -5370,7 +5370,7 @@ int cmd_pack_objects(int argc,\n \tif (!HAVE_THREADS && delta_search_threads != 1)\n \t\twarning(_(\"no threads support, ignoring --threads\"));\n \tif (!pack_to_stdout && !pack_size_limit)\n-\t\tpack_size_limit = pack_size_limit_cfg;\n+\t\tpack_size_limit = cfg->pack_size_limit;\n \tif (pack_to_stdout && pack_size_limit)\n \t\tdie(_(\"--max-pack-size cannot be used to build a pack for transfer\"));\n \tif (pack_size_limit && pack_size_limit < 1024*1024) {\ndiff --git a/environment.c b/environment.c\nindex 5a2eb8b2e4..b004029025 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -57,7 +57,6 @@ char *check_roundtrip_encoding;\n #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS\n #endif\n int grafts_keep_true_parents;\n-unsigned long pack_size_limit_cfg;\n \n #ifndef PROTECT_HFS_DEFAULT\n #define PROTECT_HFS_DEFAULT 0\n@@ -728,7 +727,7 @@ int git_default_config(const char *var, const char *value,\n \t}\n \n \tif (!strcmp(var, \"pack.packsizelimit\")) {\n-\t\tpack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi);\n+\t\tcfg->pack_size_limit = git_config_ulong(var, value, ctx->kvi);\n \t\treturn 0;\n \t}\n \n@@ -769,7 +768,6 @@ void repo_config_values_init(struct repo_config_values *cfg)\n \tcfg->trust_executable_bit = 1;\n \tcfg->has_symlinks = platform_has_symlinks();\n \n-\n \t/* section \"branch\" config values */\n \tcfg->branch_track = BRANCH_TRACK_REMOTE;\n }\ndiff --git a/environment.h b/environment.h\nindex b336459e90..070314f7ef 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -132,6 +132,7 @@ struct repo_config_values {\n \tint check_stat;\n \tint zlib_compression_level;\n \tint pack_compression_level;\n+\tunsigned long pack_size_limit;\n \tint precomposed_unicode;\n \tint core_sparse_checkout_cone;\n \tint warn_on_object_refname_ambiguity;\n@@ -235,8 +236,6 @@ int have_git_dir(void);\n /* Environment bits from configuration mechanism */\n extern int minimum_abbrev, default_abbrev;\n extern int assume_unchanged;\n-extern unsigned long pack_size_limit_cfg;\n-\n extern int grafts_keep_true_parents;\n \n const char *get_log_output_encoding(void);\ndiff --git a/object-file.c b/object-file.c\nindex c049bf13f7..7f55e6331f 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -882,6 +882,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas\n \t\t\t\t\t\t\t\t struct odb_transaction_files,\n \t\t\t\t\t\t\t\t base);\n \tstruct transaction_packfile *state = &transaction->packfile;\n+\tstruct repo_config_values *cfg =\n+\t\trepo_config_values(the_repository);\n \tstruct git_hash_ctx ctx;\n \tunsigned char obuf[16384];\n \tunsigned header_len;\n@@ -903,8 +905,8 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas\n \t * the difference between the inflated and on-disk size is limited\n \t * to zlib compression and is sufficient for this check.\n \t */\n-\tif (state->nr_written && pack_size_limit_cfg &&\n-\t    pack_size_limit_cfg < state->offset + stream->size) {\n+\tif (state->nr_written && cfg->pack_size_limit &&\n+\t    cfg->pack_size_limit < state->offset + stream->size) {\n \t\tflush_packfile_transaction(transaction);\n \t\todb_reprepare(transaction->base.source->odb);\n \t}\n-- \ngitgitgadget\n\n"},{"id":"557565","messageId":"CAKrRMNqzOX=vUUMrMf5P_Atar8_qCSbGdtBktfT+iL4hJfFX-Q@mail.gmail.com","threadId":"66607","inReplyTo":"ba34e82a0a6a99181637e2fe33be5506f2a1bdd0.1793710118.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 2/2] config: move pack size limit into repo config","fromName":"Tanga Joris","fromEmail":"tangajoris@gmail.com","sentAt":"2026-11-05T15:14:44Z","receivedAt":"2026-11-05T15:14:44Z","isPatch":true,"sender":{"key":"tangajoris@gmail.com","avatar":null},"body":"Hello Joy,\n\nThanks for the new version.\n\nI fetched v3 with the Fetch-It-Via line and built it. t1300, t5300\nand t7700 pass, and pack.packSizeLimit still works: with\n\"-c pack.packSizeLimit=1m\", \"git repack -ad\" on three 700 kB files\ngives three packs.\n\nOne thing you may not have seen: Junio has a patch,\n\"repo_config_values: freeze the structure for now\" [1], resent to\nthe list on 3 November. It adds a comment to struct\nrepo_config_values saying not to add any new members until it can\nwork on a repository other than the_repository, and Patrick acked\nit. It is in 'seen' as jc/freeze-repo-config-values, and 2/2 goes\nagainst what that comment asks.\n\nSeparately, v3 does not merge cleanly with 'seen' because\nobject-file.c conflicts with Christian's cc/pack-index-v3.\n\nOn Tue, 3 Nov 2026 at 16:14, Joy Gundu via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> +       unsigned long pack_size_limit;\n\nSince 2/2 adds a member to that structure, I think it cannot go in\nlike this for now. 1/2 does not add one, so maybe it could be sent\non its own? Christian or Usman probably know better what to do next.\n\nTwo small things in case you send another version. 1/2 leaves two\nblank lines in a row in repo_config_values_init(), and 2/2 removes\none of them, so that fix belongs in 1/2. And the cover letter still\nsays \"Changes since v1\" and lists the v1 to v2 changes, so it does\nnot say what changed in v3.\n\n[1] https://lore.kernel.org/git/xmqq1p917kwl.fsf@gitster.g/\n\nThanks,\nTanga\n\n"}]}