From: Phillip Wood <phillip.wood123@gmail.com>
To: Ayush Chandekar <ayu.chandekar@gmail.com>, phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, christian.couder@gmail.com,
shyamthakkar001@gmail.com, Junio C Hamano <gitster@pobox.com>
Subject: Re: [GSOC PATCH 1/2] environment: remove the global variable 'merge_log_config'
Date: Wed, 30 Jul 2025 09:53:51 +0100 [thread overview]
Message-ID: <1f07119e-64b6-453f-ae83-64a5fb486188@gmail.com> (raw)
In-Reply-To: <CAE7as+Y_S=J8D4xrV75w2KJCKzpHamYt4Ug_iGD068i3Kdq5JA@mail.gmail.com>
Hi Ayush
On 29/07/2025 22:16, Ayush Chandekar wrote:
>
> On Wed, Jul 30, 2025 at 12:37 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
>>
>> Hi Ayush
>>
>> On 29/07/2025 17:19, Ayush Chandekar wrote:
>>>
>>> @@ -26,14 +26,7 @@ static struct string_list suppress_dest_patterns = STRING_LIST_INIT_DUP;
>>> int fmt_merge_msg_config(const char *key, const char *value,
>>> const struct config_context *ctx, void *cb)
>>> {
>>> - if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
>>> - int is_bool;
>>> - merge_log_config = git_config_bool_or_int(key, value, ctx->kvi, &is_bool);
>>> - if (!is_bool && merge_log_config < 0)
>>> - return error("%s: negative length %s", key, value);
>>> - if (is_bool && merge_log_config)
>>> - merge_log_config = DEFAULT_MERGE_LOG_LEN;
>>> - } else if (!strcmp(key, "merge.branchdesc")) {
>>
>> In the old code if both "merge.log" and "merge.summary" are set in the
>> config file the last one wins
>>
>>> +void adjust_shortlog_len(struct repository *r, int *shortlog_len)
>>> +{
>>> + const char *keys[] = { "merge.log", "merge.summary", NULL};
>>> +
>>> + if (*shortlog_len >= 0)
>>> + return;
>>> +
>>> + for (const char **key = keys; *key; ++key) {
>>> + int is_bool, value;
>>> + if (!repo_config_get_bool_or_int(r, *key, &is_bool, &value)) {
>>> + if (!is_bool && value < 0) {
>>> + error("%s: negative length %d", *key, value);
>>> + return;
>>> + }
>>> + *shortlog_len = (is_bool && value) ? DEFAULT_MERGE_LOG_LEN : value;
>>> + return;
>>
>> In the new code "merge.log" is always used in preference to
>> "merge.summary" even if "merge.summary" appears later in the config
>> file. When you have two keys setting the same variable I think the only
>> way to preserve the last one wins behavior is to keep using a callback
>> that updates the value as the config files are parsed.
>>
>
> Sorry for not mentioning this in the commit message.
>
> I had looked at the documentation which says:
>
> Documentation/git-fmt-merge-msg.adoc
> merge.summary::
> Synonym to `merge.log`; this is deprecated and will be removed in
> the future.
>
> So I thought that I should give precedence to "merge.log" as
> "merge.summary" is deprecated.
If it is deprecated we still need to support it until it is removed
(maybe we should do that in Git 3.0?). We cannot change the behavior
just because a setting is deprecated.
Thanks
Phillip
>> Thanks
>>
>> Phillip
>>
>
> Thanks
> Ayush
>
next prev parent reply other threads:[~2025-07-30 8:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 16:19 [GSOC PATCH 0/2] builtin/fmt-merge-msg: remove dependency on global variables and 'the_repository' Ayush Chandekar
2025-07-29 16:19 ` [GSOC PATCH 1/2] environment: remove the global variable 'merge_log_config' Ayush Chandekar
2025-07-29 16:48 ` Junio C Hamano
2025-07-29 17:30 ` Ayush Chandekar
2025-07-29 17:53 ` Junio C Hamano
2025-07-29 19:07 ` Phillip Wood
2025-07-29 21:16 ` Ayush Chandekar
2025-07-30 8:53 ` Phillip Wood [this message]
2025-07-29 16:19 ` [GSOC PATCH 2/2] builtin/fmt-merge-msg: stop depending on 'the_repository' Ayush Chandekar
2025-07-29 16:41 ` Junio C Hamano
2025-07-29 21:49 ` Ayush Chandekar
2025-07-29 22:41 ` Junio C Hamano
2025-08-10 15:33 ` [GSOC PATCH 0/2] builtin/fmt-merge-msg: remove dependency on global variables and 'the_repository' Ayush Chandekar
2025-08-10 23:45 ` [GSOC PATCH v2 " Ayush Chandekar
2025-08-10 23:45 ` [GSOC PATCH v2 1/2] environment: remove the global variable 'merge_log_config' Ayush Chandekar
2025-08-11 14:42 ` Phillip Wood
2025-08-11 16:13 ` Junio C Hamano
2025-08-11 18:25 ` Ayush Chandekar
2025-08-10 23:45 ` [GSOC PATCH v2 2/2] builtin/fmt-merge-msg: stop depending on 'the_repository' Ayush Chandekar
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=1f07119e-64b6-453f-ae83-64a5fb486188@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=shyamthakkar001@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;
as well as URLs for NNTP newsgroup(s).