mergetools: add support for guiffy
[gitweb.git] / git-add--interactive.perl
index 7a0c95fd0deb685a43fd3aa4bd88515ce0eb9fcd..c1f52e457f6c5b03947766555e10fba33e7e1b38 100755 (executable)
@@ -705,6 +705,14 @@ sub parse_diff {
        }
        my (@hunk) = { TEXT => [], DISPLAY => [], TYPE => 'header' };
 
+       if (@colored && @colored != @diff) {
+               print STDERR
+                 "fatal: mismatched output from interactive.diffFilter\n",
+                 "hint: Your filter must maintain a one-to-one correspondence\n",
+                 "hint: between its input and output lines.\n";
+               exit 1;
+       }
+
        for (my $i = 0; $i < @diff; $i++) {
                if ($diff[$i] =~ /^@@ /) {
                        push @hunk, { TEXT => [], DISPLAY => [],
@@ -1556,7 +1564,7 @@ sub patch_update_file {
                                        error_msg __("No other hunks to search\n");
                                        next;
                                }
-                               if ($1 eq "") {
+                               if ($regex eq "") {
                                        print colored $prompt_color, __("search for regex? ");
                                        $regex = <STDIN>;
                                        if (defined $regex) {