From: Junio C Hamano <gitster@pobox.com>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: git@vger.kernel.org, Tian Yuchen <cat@malon.dev>,
Olamide Caleb Bello <belkid98@gmail.com>
Subject: Re: [PATCH v4 2/3] environment: align repo_config_values_init with struct declaration
Date: Thu, 20 Aug 2026 10:45:43 -0700 [thread overview]
Message-ID: <xmqqa4qgsn20.fsf@gitster.g> (raw)
In-Reply-To: <5693baa9923afd20333c0eb016cc5949f8dfc423.1787231825.git.ben.knoble@gmail.com> (D. Ben Knoble's message of "Thu, 20 Aug 2026 09:18:08 -0400")
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
> The order of assignments in repo_config_values_init is chaotic and hard
> to follow, especially when comparing with the struct definition to
> ensure all members are initialized. As new members will be added in the
> future, make it easier to validate changes by aligning the two.
>
> Refactor assignment order with no behavioral changes.
After reading the above three times, I am tempted to slightly tweak
the above:
... comparing with the definition of 'struct repo_config_values' to
ensure ...
Other than that, great improvement.
Thanks.
>
> Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
> ---
> environment.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/environment.c b/environment.c
> index 76ee65e62b..6676e6f5ae 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -745,6 +745,7 @@ int git_default_config(const char *var, const char *value,
>
> void repo_config_values_init(struct repo_config_values *cfg)
> {
> + /* section "core" config values */
> cfg->attributes_file = NULL;
> cfg->excludes_file = NULL;
> cfg->editor_program = NULL;
> @@ -756,20 +757,24 @@ void repo_config_values_init(struct repo_config_values *cfg)
> cfg->autorebase = AUTOREBASE_NEVER;
> cfg->object_creation_mode = OBJECT_CREATION_MODE;
> cfg->apply_sparse_checkout = 0;
> - 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->branch_track = BRANCH_TRACK_REMOTE;
> 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->sparse_expect_files_outside_of_patterns = 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();
> +
> + /* section "sparse" config values */
> + cfg->sparse_expect_files_outside_of_patterns = 0;
> +
> + /* section "branch" config values */
> + cfg->branch_track = BRANCH_TRACK_REMOTE;
> }
>
> void repo_config_values_clear(struct repo_config_values *cfg)
next prev parent reply other threads:[~2026-08-20 17:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 11:56 [PATCH 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-07 11:56 ` [PATCH 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-10 12:50 ` Patrick Steinhardt
2026-08-07 11:56 ` [PATCH 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-07 11:56 ` [PATCH 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-07 21:17 ` Junio C Hamano
2026-08-08 16:31 ` SZEDER Gábor
2026-08-10 12:27 ` D. Ben Knoble
2026-08-10 12:27 ` D. Ben Knoble
2026-08-10 12:44 ` Patrick Steinhardt
2026-08-11 16:26 ` Ben Knoble
2026-08-13 21:40 ` D. Ben Knoble
2026-08-14 11:06 ` Patrick Steinhardt
2026-08-14 11:29 ` Ben Knoble
2026-08-10 12:50 ` Patrick Steinhardt
2026-08-14 12:33 ` [PATCH v2 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-14 12:34 ` [PATCH v2 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-14 12:34 ` [PATCH v2 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-14 12:34 ` [PATCH v2 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-14 16:38 ` Junio C Hamano
2026-08-14 19:03 ` D. Ben Knoble
2026-08-18 14:59 ` [PATCH v3 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-18 14:59 ` [PATCH v3 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-18 14:59 ` [PATCH v3 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-18 14:59 ` [PATCH v3 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-18 18:51 ` Junio C Hamano
2026-08-19 12:53 ` D. Ben Knoble
2026-08-19 8:24 ` Patrick Steinhardt
2026-08-19 13:09 ` D. Ben Knoble
2026-08-20 5:24 ` Patrick Steinhardt
2026-08-20 11:50 ` D. Ben Knoble
2026-08-19 16:15 ` Junio C Hamano
2026-08-19 22:56 ` D. Ben Knoble
2026-08-20 5:26 ` Patrick Steinhardt
2026-08-20 13:18 ` [PATCH v4 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-20 13:18 ` [PATCH v4 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-20 13:18 ` [PATCH v4 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-20 17:45 ` Junio C Hamano [this message]
2026-08-20 13:18 ` [PATCH v4 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
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=xmqqa4qgsn20.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=belkid98@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=cat@malon.dev \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.