cvsimport: apply shell-quoting regex globally
authorJeff King <peff@peff.net>
Fri, 8 Dec 2017 09:58:19 +0000 (04:58 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Dec 2017 17:02:54 +0000 (09:02 -0800)
Commit 5b4efea666 (cvsimport: shell-quote variable used in
backticks, 2017-09-11) tried to shell-quote a variable, but
forgot to use the "/g" modifier to apply the quoting to the
whole variable. This means we'd miss any embedded
single-quotes after the first one.

Reported-by: <littlelailo@yahoo.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-cvsimport.perl
index 36929921ea79006dc659f6996ae158131ccf2b73..2d8df831722913093a46e9325796b85f67a97073 100755 (executable)
@@ -642,7 +642,7 @@ sub is_sha1 {
 
 sub get_headref ($) {
        my $name = shift;
-       $name =~ s/'/'\\''/;
+       $name =~ s/'/'\\''/g;
        my $r = `git rev-parse --verify '$name' 2>/dev/null`;
        return undef unless $? == 0;
        chomp $r;