All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Yannik Tausch <dev@ytausch.de>
Cc: git@vger.kernel.org,
	 Manuel Lerchner <manuel.lerchner@quantco.com>,
	Yannik Tausch <yannik.tausch@quantco.com>
Subject: Re: [PATCH] merge-file: honor merge.conflictStyle outside of a repository
Date: Thu, 05 Feb 2026 12:44:08 -0800	[thread overview]
Message-ID: <xmqq8qd6ly3r.fsf@gitster.g> (raw)
In-Reply-To: <3724733C-FECB-47F5-841C-84DE9792332D@ytausch.de> (Yannik Tausch's message of "Thu, 5 Feb 2026 21:27:21 +0100")

Yannik Tausch <dev@ytausch.de> 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)

  reply	other threads:[~2026-02-05 20:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 15:06 [DOC] merge-file: document that merge.conflictStyle requires a repository Yannik Tausch
2026-02-05 19:11 ` Junio C Hamano
2026-02-05 20:27   ` [PATCH] merge-file: honor merge.conflictStyle outside of " Yannik Tausch
2026-02-05 20:44     ` Junio C Hamano [this message]
2026-02-05 20:51     ` Kristoffer Haugsbakk
2026-02-05 21:55       ` [PATCH v2] " Yannik Tausch
2026-02-06 21:53         ` Junio C Hamano
2026-02-07 21:28           ` Yannik Tausch
2026-02-07 21:37             ` Yannik Tausch
2026-02-07 21:47               ` Kristoffer Haugsbakk
2026-02-09  9:08               ` Patrick Steinhardt
2026-02-09 16:13                 ` Junio C Hamano

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=xmqq8qd6ly3r.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=dev@ytausch.de \
    --cc=git@vger.kernel.org \
    --cc=manuel.lerchner@quantco.com \
    --cc=yannik.tausch@quantco.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.