From 343dd36a6ab2eb8d838a9c1ba124180a8244818e Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Mon, 23 Nov 2015 21:12:01 -0800 Subject: [PATCH] cmds: properly support xfce4-terminal and gnome-terminal Some terminal require that their `-e` argument is passed as a single string, rather than what xterm et al. do where the -e indicates the the rest of the command line is the command to execute. Quote the argument to `-e` when the terminal needs it. Closes #524 Helped-by: @anderben via github.com Signed-off-by: David Aguilar --- cola/cmds.py | 9 +++++++-- cola/gitcfg.py | 2 +- share/doc/git-cola/relnotes/unreleased.rst | 9 +++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cola/cmds.py b/cola/cmds.py index 3c5be973..7c48cf23 100644 --- a/cola/cmds.py +++ b/cola/cmds.py @@ -823,8 +823,13 @@ class LaunchDifftool(BaseCommand): cfg = gitcfg.current() cmd = cfg.terminal() argv = utils.shell_split(cmd) - argv.extend(['git', 'mergetool', '--no-prompt', '--']) - argv.extend(paths) + mergetool = ['git', 'mergetool', '--no-prompt', '--'] + mergetool.extend(paths) + needs_shellquote = set(['gnome-terminal', 'xfce4-terminal']) + if os.path.basename(argv[0]) in needs_shellquote: + argv.append(subprocess.list2cmdline(mergetool)) + else: + argv.extend(mergetool) core.fork(argv) else: difftool.run() diff --git a/cola/gitcfg.py b/cola/gitcfg.py index 1a6d250a..7625e7be 100644 --- a/cola/gitcfg.py +++ b/cola/gitcfg.py @@ -385,7 +385,7 @@ class GitConfig(observable.Observable): if not term: # find a suitable default terminal term = 'xterm -e' # for mac osx - candidates = ('xfce4-terminal', 'konsole') + candidates = ('xfce4-terminal', 'konsole', 'gnome-terminal') for basename in candidates: if core.exists('/usr/bin/%s' % basename): term = '%s -e' % basename diff --git a/share/doc/git-cola/relnotes/unreleased.rst b/share/doc/git-cola/relnotes/unreleased.rst index bc4b3c80..1274f7e9 100644 --- a/share/doc/git-cola/relnotes/unreleased.rst +++ b/share/doc/git-cola/relnotes/unreleased.rst @@ -61,3 +61,12 @@ Usability, bells and whistles https://github.com/git-cola/git-cola/issues/468 +Fixes +----- + +* `xfce4-terminal` and `gnome-terminal` are now supported when launching + `git mergetool` to resolve merges. These terminals require that the command + to execute is shell-quoted and passed as a single string argument to `-e` + rather than as additional command line arguments. + + https://github.com/git-cola/git-cola/issues/524 -- 2.11.4.GIT