summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-06-21 19:28:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-21 21:06:20 (GMT)
commitd85d7ecb80ebc93f7380b4196c303756ee051668 (patch)
treee6d3a487d649072ded75b3141c9152664d7fdd3b /t/t3701-add-interactive.sh
parentd5addcf522deb05d259ecbc0946584d977879565 (diff)
downloadgit-d85d7ecb80ebc93f7380b4196c303756ee051668.zip
git-d85d7ecb80ebc93f7380b4196c303756ee051668.tar.gz
git-d85d7ecb80ebc93f7380b4196c303756ee051668.tar.bz2
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 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index deae948..2bfd41f 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