git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "ToBoMi via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: ToBoMi <tobias.boesch@miele.com>, deboeto <tobias.boesch@miele.com>
Subject: [PATCH] git gui: add directly calling merge tool from gitconfig
Date: Mon, 19 Aug 2024 11:29:04 +0000	[thread overview]
Message-ID: <pull.1773.git.1724066944786.gitgitgadget@gmail.com> (raw)

From: deboeto <tobias.boesch@miele.com>

* git Gui can open a merge tool when conflicts are
    detected. The merge tools that are allowed to
    call have to be hard coded into git Gui
    althgough there are configuration options for
    merge tools git in the git config. Git calls
    the configured merge tools directly from the
    config while git Gui doesn't.
* git Gui can now call the tool configured in the
    gitconfig directly.
* Can be enabled through setting
    gui.mergeToolFromConfig
* Disabled by default, since option is most likely
    never set
* bc3 and vscode tested

Signed-off-by: deboeto <tobias.boesch@miele.com>
---
    git gui: add directly calling merge tool from gitconfig

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1773%2FToBoMi%2Fadd_merge_tool_from_config_file-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1773/ToBoMi/add_merge_tool_from_config_file-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1773

 Documentation/config/gui.txt |  4 ++++
 git-gui/lib/mergetool.tcl    | 11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/config/gui.txt b/Documentation/config/gui.txt
index 171be774d24..e63d0b46e7c 100644
--- a/Documentation/config/gui.txt
+++ b/Documentation/config/gui.txt
@@ -55,3 +55,7 @@ gui.blamehistoryctx::
 	linkgit:gitk[1] for the selected commit, when the `Show History
 	Context` menu item is invoked from 'git gui blame'. If this
 	variable is set to zero, the whole history is shown.
+
+gui.mergeToolFromConfig::
+	If true, allow to call the merge tool configured in gitconfig
+	in git gui directly.
\ No newline at end of file
diff --git a/git-gui/lib/mergetool.tcl b/git-gui/lib/mergetool.tcl
index e688b016ef6..fbd0889612a 100644
--- a/git-gui/lib/mergetool.tcl
+++ b/git-gui/lib/mergetool.tcl
@@ -272,8 +272,15 @@ proc merge_resolve_tool2 {} {
 		}
 	}
 	default {
-		error_popup [mc "Unsupported merge tool '%s'" $tool]
-		return
+		if {[is_config_true gui.mergetoolfromconfig]} {
+			set path [get_config mergetool.$tool.path]
+			set cmdline_config [get_config mergetool.$tool.cmd]
+			set cmdline_substituted [subst -nobackslashes -nocommands $cmdline_config]
+			set cmdline [lreplace $cmdline_substituted 0 0 $path]
+		} else {
+			error_popup [mc "Unsupported merge tool '%s'" $tool]
+			return
+		}
 	}
 	}
 

base-commit: b9849e4f7631d80f146d159bf7b60263b3205632
-- 
gitgitgadget

             reply	other threads:[~2024-08-19 11:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 11:29 ToBoMi via GitGitGadget [this message]
2024-08-24 13:38 ` [PATCH] git gui: add directly calling merge tool from gitconfig Johannes Sixt
2024-08-27 12:51   ` AW: " tobias.boesch
2024-08-27 13:53   ` tobias.boesch
2024-08-28  8:31 ` [PATCH v2] " ToBoMi via GitGitGadget
2024-08-28 17:08   ` Junio C Hamano
2024-09-05  8:09     ` AW: " tobias.boesch
2024-08-31 13:51   ` Johannes Sixt
2024-09-06  6:32     ` AW: " tobias.boesch
2024-09-06 17:43       ` Johannes Sixt
2024-09-06  7:27   ` [PATCH v3] " ToBoMi via GitGitGadget
2024-09-08 12:21     ` Johannes Sixt
2024-09-11 13:41       ` AW: " tobias.boesch
2024-09-11 14:23     ` [PATCH v4] git gui: add directly calling merge tool from configuration ToBoMi via GitGitGadget
2024-09-12 10:17       ` [PATCH v5] " ToBoMi via GitGitGadget
2024-09-14 13:32         ` Johannes Sixt
2024-09-16  8:42           ` AW: " tobias.boesch
2024-11-07 14:16             ` tobias.boesch
2024-11-07 16:43               ` Johannes Sixt

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=pull.1773.git.1724066944786.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=tobias.boesch@miele.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).