diff options
-rwxr-xr-x | git-add--interactive.perl | 2 | ||||
-rwxr-xr-x | t/t3701-add-interactive.sh | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 7c95324737..395dd5eb4b 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -1097,7 +1097,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; diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index deae948c76..2bfd41f06e 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -380,4 +380,12 @@ test_expect_success 'patch mode ignores unmerged entries' ' test_cmp expected diff ' +test_expect_success 'hunk-editing handles custom comment char' ' + git reset --hard && + echo change >>file && + test_config core.commentChar "\$" && + echo e | GIT_EDITOR=true git add -p && + git diff --exit-code +' + test_done |