From aae153db1b10288c2ce5b698fd40a14d7980846c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 17 Jun 2018 15:24:30 +0300 Subject: [PATCH] Git: Abort mergetool if not configured MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When merge.tool is not configured, mergetool is not started, and the following message is displayed: This message is displayed because 'merge.tool' is not configured. See 'git mergetool --tool-help' or 'git help config' for more details. 'git mergetool' will now attempt to use one of the following tools: opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare emerge vimdiff Merging: test.cpp Normal merge conflict for 'test.cpp': {local}: modified file {remote}: modified file Hit return to start merge resolution tool (vimdiff): On Windows, vimdiff is the default, and since it is textual, if we use it, we have no way to pass any input for it, then we reach a dead-end. On Linux/KDE (if DISPLAY is set), Git defaults to kdiff3. This is better, but we cannot count on it even being installed. Just abort with a warning on this case, and let the user [install and] configure the preferred (graphical) mergetool. Change-Id: I7144d9348a4d1ee03176b71b4ac2242b16795403 Reviewed-by: André Hartmann --- src/plugins/git/mergetool.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp index 511a762acf4..8a224f09a7d 100644 --- a/src/plugins/git/mergetool.cpp +++ b/src/plugins/git/mergetool.cpp @@ -235,6 +235,13 @@ void MergeTool::readData() prompt(tr("Unchanged File"), tr("Was the merge successful?")); } else if (m_line.startsWith("Continue merging")) { prompt(tr("Continue Merging"), tr("Continue merging other unresolved paths?")); + } else if (m_line.startsWith("Hit return")) { + QMessageBox::warning( + Core::ICore::dialogParent(), tr("Merge Tool"), + tr("

Merge tool is not configured.

\n" + "

Run git config --global merge.tool <tool> to configure it, " + "then try again

")); + m_process->kill(); } else if (m_line.endsWith('\n')) { // Skip unidentified lines m_line.clear();