Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-06-21 22:28:59 +0300
committerJunio C Hamano <gitster@pobox.com>2017-06-22 00:06:20 +0300
commitd85d7ecb80ebc93f7380b4196c303756ee051668 (patch)
treee6d3a487d649072ded75b3141c9152664d7fdd3b /git-add--interactive.perl
parentd5addcf522deb05d259ecbc0946584d977879565 (diff)
add--interactive: quote commentChar regex
Since c9d961647 (i18n: add--interactive: mark edit_hunk_manually message for translation, 2016-12-14), when the user asks to edit a hunk manually, we respect core.commentChar in generating the edit instructions. However, when we then strip out comment lines, we use a simple regex like: /^$commentChar/ If your chosen comment character is a regex metacharacter, then that will behave in a confusing manner ("$", for instance, would only eliminate blank lines, not actual comment lines). We can fix that by telling perl not to respect metacharacters. Reported-by: Christian Rösch <christian@croesch.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl2
1 files changed, 1 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;