Git development
 help / color / mirror / Atom feed
From: "Joy 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>
Subject: [PATCH v2 0/2] config: move pack size limit into repo config
Date: Thu, 22 Oct 2026 09:47:10 +0000	[thread overview]
Message-ID: <pull.2271.v2.git.1792662432.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2271.git.1792522587065.gitgitgadget@gmail.com>

This series moves pack.packsizelimit from a standalone global variable into
struct repo_config_values, as part of the ongoing effort to reduce Git's
reliance on global state and make its code easier to reuse as a library.

The series includes two patches:

 1. Update repo_config_values_init() to use memset() for
    zero-initialization, while keeping the defaults that require explicit
    values.
 2. Move the pack size limit into repo_config_values and update the relevant
    code to read it from there.


Changes since v1
================

Thanks to Patrick Steinhardt for reviewing the first version and suggesting
the initialization cleanup.

Following his feedback, I've:

 * Added a preparatory patch to simplify how repository configuration values
   are initialized.
 * Reworked the main commit message to explain the existing problem before
   describing the change.
 * Removed the need to explicitly initialize the new pack size limit field
   to zero.


Testing
=======

I built Git and ran the relevant configuration and pack-object tests:

 * make -j2 — passed.
 * t1300-config.sh — 518 successful tests.
 * t5300-pack-object.sh — 63 passed, 2 skipped, 0 failed.

Both test runs reported permission errors during cleanup after the tests had
completed.

Joy Gundu (2):
  repo: zero-initialize configuration values
  config: move pack size limit into repo config

 builtin/pack-objects.c |  2 +-
 environment.c          | 17 +++--------------
 environment.h          |  3 +--
 object-file.c          |  6 ++++--
 4 files changed, 9 insertions(+), 19 deletions(-)


base-commit: 47fdf2208c5b94c8cc01c106b8f7c85efb91c926
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2271%2FJoiejoie1%2Foutreachy%2Fglobal-state-mini-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2271/Joiejoie1/outreachy/global-state-mini-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2271

Range-diff vs v1:

 -:  ---------- > 1:  df93a2a86c repo: zero-initialize configuration values
 1:  e3e36c3459 ! 2:  05ae50b5da config: move pack size limit into repo config
     @@ Metadata
       ## Commit message ##
          config: move pack size limit into repo config
      
     -    Store the pack.packsizelimit value in repository configuration
     -    rather than keeping it in a standalone global variable for the repository.
     +    The pack size limit is currently stored in a standalone global
     +    variable, even though it is repository configuration.
      
     -    Update the configuration parser and pack-writing code to read
     -    the value from repo_config_values rather than a global variable.
     +    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 change removes one piece of global configuration state from Git
     -    and helps make Git code easier to reuse as a library component.
     +    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>
      
     @@ environment.c: int git_default_config(const char *var, const char *value,
       		return 0;
       	}
       
     -@@ environment.c: void repo_config_values_init(struct repo_config_values *cfg)
     - 	cfg->check_stat = 1;
     - 	cfg->zlib_compression_level = Z_BEST_SPEED;
     - 	cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;
     -+	cfg->pack_size_limit = 0;
     - 	cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
     - 	cfg->core_sparse_checkout_cone = 0;
     - 	cfg->warn_on_object_refname_ambiguity = 1;
      
       ## environment.h ##
      @@ environment.h: struct repo_config_values {

-- 
gitgitgadget

  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 ` Joy via GitGitGadget [this message]
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   ` [PATCH v2 2/2] config: move pack size limit into repo config Joy Gundu via GitGitGadget
2026-10-22 11:30     ` 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=pull.2271.v2.git.1792662432.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