diff options
author | David Aguilar <davvid@gmail.com> | 2010-03-27 14:58:09 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-28 09:29:12 -0700 |
commit | 42accaec0174f80c81681c4a6f896ca452ba3f76 (patch) | |
tree | 5809f9e914e118676549432c4071a344520e8400 /git-difftool.perl | |
parent | bb6ad28c23f05e1ea04e3f1c6b9b08cc070c5318 (diff) | |
download | git-42accaec0174f80c81681c4a6f896ca452ba3f76.tar.gz |
difftool: Fix '--gui' when diff.guitool is unconfigured
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>
Diffstat (limited to 'git-difftool.perl')
-rwxr-xr-x | git-difftool.perl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/git-difftool.perl b/git-difftool.perl index d975d072db..adc42de875 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -78,11 +78,13 @@ sub generate_command 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') { |