X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-difftool.perl;h=ba5e60a45e2c4a8b54e6a58e656b3978dcb45633;hb=dff2b6d4842eef0a03a3c8b3761f72e2b55b609e;hp=8857ac8a4cfa733c1158cdb9a0d3e453bd8d235c;hpb=afcbc8e7ecb18a3ee542e808f02f5df7d56d5bdc;p=git.git diff --git a/git-difftool.perl b/git-difftool.perl index 8857ac8a4..ba5e60a45 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -2,9 +2,12 @@ # Copyright (c) 2009 David Aguilar # # 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_DIFF_TOOL for use by git-difftool--helper. +# git-difftool--helper script. +# +# This script exports GIT_EXTERNAL_DIFF and GIT_PAGER for use by git. +# GIT_DIFFTOOL_NO_PROMPT, GIT_DIFFTOOL_PROMPT, and GIT_DIFF_TOOL +# are exported for use by git-difftool--helper. +# # Any arguments that are unknown to this script are forwarded to 'git diff'. use strict; @@ -62,6 +65,12 @@ sub generate_command } if ($arg eq '-y' || $arg eq '--no-prompt') { $ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true'; + delete $ENV{GIT_DIFFTOOL_PROMPT}; + next; + } + if ($arg eq '--prompt') { + $ENV{GIT_DIFFTOOL_PROMPT} = 'true'; + delete $ENV{GIT_DIFFTOOL_NO_PROMPT}; next; } if ($arg eq '-h' || $arg eq '--help') { @@ -73,4 +82,11 @@ sub generate_command } setup_environment(); -exec(generate_command()); + +# ActiveState Perl for Win32 does not implement POSIX semantics of +# exec* system call. It just spawns the given executable and finishes +# the starting program, exiting with code 0. +# system will at least catch the errors returned by git diff, +# allowing the caller of git difftool better handling of failures. +my $rc = system(generate_command()); +exit($rc | ($rc >> 8));