From: Junio C Hamano Date: Thu, 05 Feb 2026 20:44:08 GMT Subject: Re: [PATCH] merge-file: honor merge.conflictStyle outside of a repository Message-ID: In-Reply-To: <3724733C-FECB-47F5-841C-84DE9792332D@ytausch.de> Yannik Tausch writes: > - 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)