summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-10 13:58:58 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-10 13:58:59 -0700
commitf904494574035f6ff2725b0e97951c55ccd9dee3 (patch)
tree4ce9cb8c57fb75f437d1a557d2dc94cac4d9692b /git-add--interactive.perl
parentMerge branch 'js/alias-early-config' into maint (diff)
parentadd--interactive: quote commentChar regex (diff)
downloadtgif-f904494574035f6ff2725b0e97951c55ccd9dee3.tar.xz
Merge branch 'jk/add-p-commentchar-fix' into maint
"git add -p" were updated in 2.12 timeframe to cope with custom core.commentchar but the implementation was buggy and a metacharacter like $ and * did not work. * jk/add-p-commentchar-fix: add--interactive: quote commentChar regex add--interactive: handle EOF in prompt_yesno
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 709a5f6ce6..c55c612455 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1085,7 +1085,7 @@ EOF2
open $fh, '<', $hunkfile
or die sprintf(__("failed to open hunk edit file for reading: %s"), $!);
- my @newtext = grep { !/^$comment_line_char/ } <$fh>;
+ my @newtext = grep { !/^\Q$comment_line_char\E/ } <$fh>;
close $fh;
unlink $hunkfile;
@@ -1140,6 +1140,7 @@ sub prompt_yesno {
while (1) {
print colored $prompt_color, $prompt;
my $line = prompt_single_character;
+ return undef unless defined $line;
return 0 if $line =~ /^n/i;
return 1 if $line =~ /^y/i;
}