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

Re: [PATCH] merge-tree: load default git config

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 10, 2023, 20:30 UTC
Message-ID
<645bfed357efc_3819294e1@chronos.notmuch>
In-Reply-To
<pull.1530.git.1683745654800.gitgitgadget@gmail.com>
Derrick Stolee via GitGitGadget wrote:
Show 8 quoted lines
> From: Derrick Stolee <derrickstolee@github.com>
> 
> The 'git merge-tree' command handles creating root trees for merges
> without using the worktree. This is a critical operation in many Git
> hosts, as they typically store bare repositories.
> 
> This builtin does not load the default Git config, which can have
> several important ramifications.

For the record, I had already sent a better version of this patch almost 2 years ago [1], not just for `git merge-tree`, but other commands as well.

The obvious fix was completely ignored by the maintainer.

The reason why it should be git_xmerge_config and not git_default_config, is that merge.conflictstyle would not be parsed if you call git_default_config.

Show 17 quoted lines
> diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
> index aa8040c2a6a..b8f8a8b5d9f 100644
> --- a/builtin/merge-tree.c
> +++ b/builtin/merge-tree.c
> @@ -17,6 +17,7 @@
>  #include "merge-blobs.h"
>  #include "quote.h"
>  #include "tree.h"
> +#include "config.h"
>  
>  static int line_termination = '\n';
>  
> @@ -628,6 +629,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
>  	if (argc != expected_remaining_argc)
>  		usage_with_options(merge_tree_usage, mt_options);
>  
> +	git_config(git_default_config, NULL);
It should be git_xmerge_config.
> +
>  	/* Do the relevant type of merge */
>  	if (o.mode == MODE_REAL)
>  		return real_merge(&o, merge_base, argv[0], argv[1], prefix);
[1] https://lore.kernel.org/git/20210622002714.1720891-3-felipe.contreras@gmail.com/
-- 
Felipe Contreras
Previous: Elijah NewrenNext: Derrick Stolee
Message 6 of 16 in “merge-tree: load default git config”
  1. merge-tree: load default git configDerrick Stolee via GitGitGadget, May 10, 2023
  2. Junio C HamanoMay 10, 2023
  3. Derrick StoleeMay 10, 2023
  4. Taylor BlauMay 10, 2023
  5. Elijah NewrenMay 11, 2023
  6. Felipe ContrerasMay 10, 2023
  7. Derrick StoleeMay 11, 2023
  8. Felipe ContrerasMay 11, 2023
  9. Felipe ContrerasMay 11, 2023
  10. Junio C HamanoMay 10, 2023
  11. Felipe ContrerasMay 10, 2023
  12. Felipe ContrerasMay 11, 2023
  13. Elijah NewrenMay 11, 2023
  14. Felipe ContrerasMay 11, 2023
  15. Derrick StoleeMay 11, 2023
  16. merge-tree: load config correctlyFelipe Contreras, May 11, 2023

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.