Git development
 help / color / mirror / Atom feed
* [PATCH] repo: zero-initialize configuration values
@ 2026-11-06 11:59 Joy via GitGitGadget
  2026-11-06 14:16 ` Patrick Steinhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Joy via GitGitGadget @ 2026-11-06 11:59 UTC (permalink / raw)
  To: git
  Cc: Patrick Steinhardt>, Kristoffer Haugsbakk>,
	Christian Couder>, Usman Akinyemi>, Joie Joie,
	Patrick Steinhardt, Tanga Joris, Joy, Joy Gundu

From: Joy Gundu <soniqjjj@gmail.com>

Use memset() to initialize repository configuration values to
zero, removing the need for explicit zero and NULL assignments.
Keep non-zero defaults initialized separately.

Signed-off-by: Joy Gundu <soniqjjj@gmail.com>
---
    [Outreachy] repo: zero-initialize configuration values

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2298%2FJoiejoie1%2Frepo-zero-initialize-config-values-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2298/Joiejoie1/repo-zero-initialize-config-values-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2298

 environment.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/environment.c b/environment.c
index c83cf44839..afe35cff99 100644
--- a/environment.c
+++ b/environment.c
@@ -752,34 +752,22 @@ int git_default_config(const char *var, const char *value,
 
 void repo_config_values_init(struct repo_config_values *cfg)
 {
+	memset(cfg, 0, sizeof(*cfg));
+
 	/* section "core" config values */
-	cfg->attributes_file = NULL;
-	cfg->excludes_file = NULL;
-	cfg->editor_program = NULL;
-	cfg->pager_program = NULL;
-	cfg->askpass_program = NULL;
-	cfg->apply_default_whitespace = NULL;
-	cfg->apply_default_ignorewhitespace = NULL;
 	cfg->push_default = PUSH_DEFAULT_UNSPECIFIED;
 	cfg->autorebase = AUTOREBASE_NEVER;
 	cfg->object_creation_mode = OBJECT_CREATION_MODE;
-	cfg->apply_sparse_checkout = 0;
 	cfg->trust_ctime = 1;
 	cfg->check_stat = 1;
 	cfg->zlib_compression_level = Z_BEST_SPEED;
 	cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;
 	cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
-	cfg->core_sparse_checkout_cone = 0;
 	cfg->warn_on_object_refname_ambiguity = 1;
 	cfg->protect_hfs = PROTECT_HFS_DEFAULT;
 	cfg->protect_ntfs = PROTECT_NTFS_DEFAULT;
-	cfg->ignore_case = 0;
 	cfg->trust_executable_bit = 1;
 	cfg->has_symlinks = platform_has_symlinks();
-	cfg->use_nanosec = 0;
-
-	/* section "sparse" config values */
-	cfg->sparse_expect_files_outside_of_patterns = 0;
 
 	/* section "branch" config values */
 	cfg->branch_track = BRANCH_TRACK_REMOTE;

base-commit: 3de8ebe6c8cfcd312cdbfa675635810140f84c8a
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-06 19:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 11:59 [PATCH] repo: zero-initialize configuration values Joy via GitGitGadget
2026-11-06 14:16 ` Patrick Steinhardt
2026-11-06 16:19   ` Joie Joie
2026-11-06 19:36   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox