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

Re: [GSOC PATCH 1/2] environment: remove the global variable 'merge_log_config'

From
Ayush Chandekar <ayu.chandekar@gmail.com>
Date
Jul 29, 2025, 17:30 UTC
Message-ID
<CAE7as+ZwiMENJDd6rjnF6w9tt_mJ=Kzf-t9U6VxAKmCdacOgbg@mail.gmail.com>
In-Reply-To
<xmqqfrefosdj.fsf@gitster.g>
Hi Junio,
On Tue, Jul 29, 2025 at 10:18 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 29 quoted lines
>
> Ayush Chandekar <ayu.chandekar@gmail.com> writes:
>
> > The global variable 'merge_log_config', set via the "merge.log" or
> > "merge.summary" settings, is only used in 'cmd_fmt_merge_msg()' and
> > 'cmd_merge()' to adjust the 'shortlog_len' variable.
> >
> > Remove 'merge_log_config' and introduce a function
> > 'adjust_shortlog_len()' in fmt-merge-msg.c to handle the 'shortlog_len'
> > variable.
> >
> > This change is part of an ongoing effort to eliminate global variables,
> > improve modularity and help libify the codebase.
>
> And the downsides of this change are...?
>
> One obvious behaviour change I can see can happen when you have an
> invalid value set to merge.summary and run the command with command
> line override with the "--log" option.  In the current code, the
> config callback barfs when it notices an invalid merge.summary
> setting, even though it won't be used because the valid value given
> via the "--log" option would override it.  In the updated code,
> adjust_shortlog_len() would short-circuit and does not even bother
> reading from the configuration, so the user will not be notified of
> a broken configuration.
>
> It is not immediately obvious if this particular behaviour change is
> a regression or an improvement, but it probably deserves to be noted
> somewhere to help future developers what our thinking was.

Oh right, I did not mention this in the commit message. I am not sure if this behaviour is good or not.

Technically, if the user wants to use the "--log" option, they would not care about the config. Whereas, if the user wants to use the config, they would be notified in case of an invalid one.

I will mention this in the commit message, but do you think this behaviour is fine?

Thanks Ayush

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 19 in “builtin/fmt-merge-msg: remove dependency on global variables and 'the_repository'”
  1. 0/2 builtin/fmt-merge-msg: remove dependency on global variables and 'the_repository'Ayush Chandekar, Jul 29, 2025
  2. 1/2 environment: remove the global variable 'merge_log_config'Ayush Chandekar, Jul 29, 2025
  3. Junio C HamanoJul 29, 2025
  4. Ayush ChandekarJul 29, 2025
  5. Junio C HamanoJul 29, 2025
  6. Phillip WoodJul 29, 2025
  7. Ayush ChandekarJul 29, 2025
  8. Phillip WoodJul 30, 2025
  9. 2/2 builtin/fmt-merge-msg: stop depending on 'the_repository'Ayush Chandekar, Jul 29, 2025
  10. Junio C HamanoJul 29, 2025
  11. Ayush ChandekarJul 29, 2025
  12. Junio C HamanoJul 29, 2025
  13. Ayush ChandekarAug 10, 2025
  14. 0/2 builtin/fmt-merge-msg: remove dependency on global variables and 'the_repository'Ayush Chandekar, Aug 10, 2025
  15. 1/2 environment: remove the global variable 'merge_log_config'Ayush Chandekar, Aug 10, 2025
  16. Phillip WoodAug 11, 2025
  17. Junio C HamanoAug 11, 2025
  18. Ayush ChandekarAug 11, 2025
  19. 2/2 builtin/fmt-merge-msg: stop depending on 'the_repository'Ayush Chandekar, Aug 10, 2025

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.