contrib/difftool: use a separate config namespace for difftool commands

Some users have different mergetool and difftool settings, so teach
difftool to read config vars from the difftool.* namespace.  This allows
having distinct configurations for the diff and merge scenarios.

We don't want to force existing users to set new values for no reason
so difftool falls back to existing mergetool config variables when the
difftool equivalents are not defined.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Aguilar
2009-03-09 02:12:36 -07:00
committed by Junio C Hamano
parent f4e52f0bab
commit 2464456a6a
3 changed files with 34 additions and 25 deletions

View File

@ -4,7 +4,7 @@
# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
# git-difftool-helper script. This script exports
# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
# GIT_DIFFTOOL_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
# GIT_DIFFTOOL_NO_PROMPT and GIT_DIFF_TOOL for use by git-difftool-helper.
# Any arguments that are unknown to this script are forwarded to 'git diff'.
use strict;
@ -49,12 +49,12 @@ sub generate_command
}
if ($arg eq '-t' or $arg eq '--tool') {
usage() if $#ARGV <= $idx;
$ENV{GIT_MERGE_TOOL} = $ARGV[$idx + 1];
$ENV{GIT_DIFF_TOOL} = $ARGV[$idx + 1];
$skip_next = 1;
next;
}
if ($arg =~ /^--tool=/) {
$ENV{GIT_MERGE_TOOL} = substr($arg, 7);
$ENV{GIT_DIFF_TOOL} = substr($arg, 7);
next;
}
if ($arg eq '--no-prompt') {