]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-difftool.perl
i18n: avoid parenthesized string as array initializer
[thirdparty/git.git] / git-difftool.perl
index e95e4ad973f21dd104950dc6ebb28485844b36f4..ced1615e216018bc20303cd91eaea05c69cb6b11 100755 (executable)
@@ -52,6 +52,7 @@ sub generate_command
        my @command = (exe('git'), 'diff');
        my $skip_next = 0;
        my $idx = -1;
+       my $prompt = '';
        for my $arg (@ARGV) {
                $idx++;
                if ($skip_next) {
@@ -89,13 +90,11 @@ sub generate_command
                        next;
                }
                if ($arg eq '-y' || $arg eq '--no-prompt') {
-                       $ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
-                       delete $ENV{GIT_DIFFTOOL_PROMPT};
+                       $prompt = 'no';
                        next;
                }
                if ($arg eq '--prompt') {
-                       $ENV{GIT_DIFFTOOL_PROMPT} = 'true';
-                       delete $ENV{GIT_DIFFTOOL_NO_PROMPT};
+                       $prompt = 'yes';
                        next;
                }
                if ($arg eq '-h' || $arg eq '--help') {
@@ -103,6 +102,11 @@ sub generate_command
                }
                push @command, $arg;
        }
+       if ($prompt eq 'yes') {
+               $ENV{GIT_DIFFTOOL_PROMPT} = 'true';
+       } elsif ($prompt eq 'no') {
+               $ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
+       }
        return @command
 }