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

Re: [PATCH] merge-file: honor merge.conflictStyle outside of a repository

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 5, 2026, 20:44 UTC
Message-ID
<xmqq8qd6ly3r.fsf@gitster.g>
In-Reply-To
<3724733C-FECB-47F5-841C-84DE9792332D@ytausch.de>
Yannik Tausch <dev@ytausch.de> writes:
Show 12 quoted lines
> -	if (startup_info->have_repository) {
> -		/* Read the configuration file */
> +	if (startup_info->have_repository)
>  		repo_config(the_repository, git_xmerge_config, NULL);
> -		if (0 <= git_xmerge_style)
> -			xmp.style = git_xmerge_style;
> -	}
> +	else
> +		read_very_early_config(git_xmerge_config, NULL);
> +
> +	if (0 <= git_xmerge_style)
> +		xmp.style = git_xmerge_style;

Wouldn't it suffice to unconditionally execute the body of the if (startup_info->have_repository) block to pass "repo" we obtained from the caller to repo_config() instead of the_repository? The caller of this function passes us either the_repository or NULL and repo_config() does the very-early thing when passed NULL as the repo, signalling that we are outside a repository.

IOW, something like
diff --git c/builtin/merge-file.c w/builtin/merge-file.c
index 46775d0c79..f9de636884 100644
--- c/builtin/merge-file.c
+++ w/builtin/merge-file.c
@@ -60,7 +60,7 @@ static int diff_algorithm_cb(const struct option *opt,
 int cmd_merge_file(int argc,
 		   const char **argv,
 		   const char *prefix,
-		   struct repository *repo UNUSED)
+		   struct repository *repo)
 {
 	const char *names[3] = { 0 };
 	mmfile_t mmfs[3] = { 0 };
@@ -95,12 +95,10 @@ int cmd_merge_file(int argc,
 	xmp.style = 0;
 	xmp.favor = 0;
 
-	if (startup_info->have_repository) {
-		/* Read the configuration file */
-		repo_config(the_repository, git_xmerge_config, NULL);
-		if (0 <= git_xmerge_style)
-			xmp.style = git_xmerge_style;
-	}
+	/* Read the configuration file */
+	repo_config(repo, git_xmerge_config, NULL);
+	if (0 <= git_xmerge_style)
+		xmp.style = git_xmerge_style;
 
 	argc = parse_options(argc, argv, prefix, options, merge_file_usage, 0);
 	if (argc != 3)
Previous: Yannik TauschNext: Kristoffer Haugsbakk
Message 4 of 12 in “[DOC] merge-file: document that merge.conflictStyle requires a repository”
  1. Yannik TauschFeb 5, 2026
  2. Junio C HamanoFeb 5, 2026
  3. merge-file: honor merge.conflictStyle outside of a repositoryYannik Tausch, Feb 5, 2026
  4. Junio C HamanoFeb 5, 2026
  5. Kristoffer HaugsbakkFeb 5, 2026
  6. Yannik TauschFeb 5, 2026
  7. Junio C HamanoFeb 6, 2026
  8. Yannik TauschFeb 7, 2026
  9. merge-file: honor merge.conflictStyle outside of a repositoryYannik Tausch, Feb 7, 2026
  10. Kristoffer HaugsbakkFeb 7, 2026
  11. Patrick SteinhardtFeb 9, 2026
  12. Junio C HamanoFeb 9, 2026

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.