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

[PATCH v3 0/2] [Outreachy] config: move pack size limit into repo config

From
JGJoy via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 3, 2026, 12:48 UTC
Message-ID
<pull.2271.v3.git.1793710118.gitgitgadget@gmail.com>
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          | 19 +++----------------
 environment.h          |  3 +--
 object-file.c          |  6 ++++--
 4 files changed, 9 insertions(+), 21 deletions(-)
base-commit: 47fdf2208c5b94c8cc01c106b8f7c85efb91c926
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2271%2FJoiejoie1%2Foutreachy%2Fglobal-state-mini-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2271/Joiejoie1/outreachy/global-state-mini-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/2271
Range-diff vs v2:
 1:  df93a2a86c ! 1:  dc18b66976 repo: zero-initialize configuration values
     @@ Metadata
       ## Commit message ##
          repo: zero-initialize configuration values
      
     +    When initializing struct repo_config_values, we explicitly initialize
     +    several members to zero or NULL. This adds unnecessary boilerplate as
     +    more configuration values are added to the structure.
     +
     +    Zero-initialize the entire structure with memset() instead, leaving
     +    only members with non-zero defaults to be initialized individually.
     +
          Signed-off-by: Joy Gundu <soniqjjj@gmail.com>
      
       ## environment.c ##
     @@ environment.c: int git_default_config(const char *var, const char *value,
       	cfg->has_symlinks = platform_has_symlinks();
      -	cfg->use_nanosec = 0;
       
     - 	/* section "sparse" config values */
     +-	/* section "sparse" config values */
      -	cfg->sparse_expect_files_outside_of_patterns = 0;
       
       	/* section "branch" config values */
 2:  05ae50b5da ! 2:  ba34e82a0a config: move pack size limit into repo config
     @@ 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->trust_executable_bit = 1;
     + 	cfg->has_symlinks = platform_has_symlinks();
     + 
     +-
     + 	/* section "branch" config values */
     + 	cfg->branch_track = BRANCH_TRACK_REMOTE;
     + }
      
       ## environment.h ##
      @@ environment.h: struct repo_config_values {
-- 
gitgitgadget
Previous: Patrick SteinhardtNext: Joy Gundu via GitGitGadget
Message 13 of 16 in “config: move pack size limit into repo config”
  1. config: move pack size limit into repo configJoy via GitGitGadget, Oct 20, 2026
  2. Kristoffer HaugsbakkOct 20, 2026
  3. Patrick SteinhardtOct 21, 2026
  4. Joie JoieOct 21, 2026
  5. 0/2 config: move pack size limit into repo configJoy via GitGitGadget, Oct 22, 2026
  6. 1/2 repo: zero-initialize configuration valuesJoy Gundu via GitGitGadget, Oct 22, 2026
  7. Patrick SteinhardtOct 22, 2026
  8. Joie JoieOct 23, 2026
  9. Patrick SteinhardtOct 26, 2026
  10. 2/2 config: move pack size limit into repo configJoy Gundu via GitGitGadget, Oct 22, 2026
  11. Patrick SteinhardtOct 22, 2026
  12. Patrick SteinhardtOct 22, 2026
  13. 0/2 [Outreachy] config: move pack size limit into repo configJoy via GitGitGadget, Nov 3, 2026
  14. 1/2 repo: zero-initialize configuration valuesJoy Gundu via GitGitGadget, Nov 3, 2026
  15. 2/2 config: move pack size limit into repo configJoy Gundu via GitGitGadget, Nov 3, 2026
  16. Tanga JorisNov 5, 2026

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.