summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bb6ad28)
raw | patch | inline | side by side (parent: bb6ad28)
author | David Aguilar <davvid@gmail.com> | |
Sat, 27 Mar 2010 21:58:09 +0000 (14:58 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 28 Mar 2010 16:29:12 +0000 (09:29 -0700) |
When diff.guitool is unconfigured and "--gui" is specified
git-difftool dies with the following error message:
config diff.guitool: command returned error: 1
Catch the error so that the "--gui" flag is a no-op when
diff.guitool is unconfigured.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-difftool dies with the following error message:
config diff.guitool: command returned error: 1
Catch the error so that the "--gui" flag is a no-op when
diff.guitool is unconfigured.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-difftool.perl | patch | blob | history | |
t/t7800-difftool.sh | patch | blob | history |
diff --git a/git-difftool.perl b/git-difftool.perl
index d975d072dbf0fab36266c3f3a71a69875206e4d8..adc42de8752fd395707f1e395c61991b3146cebb 100755 (executable)
--- a/git-difftool.perl
+++ b/git-difftool.perl
next;
}
if ($arg eq '-g' || $arg eq '--gui') {
- my $tool = Git::command_oneline('config',
- 'diff.guitool');
- if (length($tool)) {
- $ENV{GIT_DIFF_TOOL} = $tool;
- }
+ eval {
+ my $tool = Git::command_oneline('config',
+ 'diff.guitool');
+ if (length($tool)) {
+ $ENV{GIT_DIFF_TOOL} = $tool;
+ }
+ };
next;
}
if ($arg eq '-y' || $arg eq '--no-prompt') {
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 19c72f55bf60c746f72e640e24043b2d83e00fe3..1de83ef98fdcbfd63469e66ba4886c2477b983ff 100755 (executable)
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
restore_test_defaults
'
+test_expect_success 'difftool --gui works without configured diff.guitool' '
+ git config diff.tool test-tool &&
+
+ diff=$(git difftool --no-prompt --gui branch) &&
+ test "$diff" = "branch" &&
+
+ restore_test_defaults
+'
+
# Specify the diff tool using $GIT_DIFF_TOOL
test_expect_success 'GIT_DIFF_TOOL variable' '
git config --unset diff.tool