threads / patch / 47406

patchcvsimport: apply shell-quoting regex globally

Subject: [PATCH] cvsimport: apply shell-quoting regex globally

## tl;dr

One message between Dec 8, 2017 and Dec 8, 2017. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Jeff King· Dec 8, 2017, 09:58 UTC · lore

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>
---
 git-cvsimport.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to git-cvsimport.perl +1 −1
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 36929921ea..2d8df83172 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -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;
-- 
2.15.1.659.g8bd2eae3ea

← back to recent threads