summaryrefslogtreecommitdiff
path: root/git-request-pull.sh
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-05-28 10:15:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-28 20:06:21 (GMT)
commit5731dfce06a19f59aa1be2bd2120584864d8983b (patch)
tree00ef6426fde686327d1928d840e8da1639c9cb46 /git-request-pull.sh
parentaeb582a98374c094361cba1bd756dc6307432c42 (diff)
downloadgit-5731dfce06a19f59aa1be2bd2120584864d8983b.zip
git-5731dfce06a19f59aa1be2bd2120584864d8983b.tar.gz
git-5731dfce06a19f59aa1be2bd2120584864d8983b.tar.bz2
request-pull: quote regex metacharacters in local ref
The local part of the third argument of git-request-pull is used in a regular expression without quoting it. Use qr{} and \Q\E to ensure that e.g. a period in a tag name does not match any character on the remote side. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-request-pull.sh')
-rwxr-xr-xgit-request-pull.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 13c172b..0d128be 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -83,19 +83,18 @@ die "fatal: No commits in common between $base and $head"
# Otherwise find a random ref that matches $headrev.
find_matching_ref='
my ($head,$headrev) = (@ARGV);
+ my $pattern = qr{/\Q$head\E$};
my ($found);
while (<STDIN>) {
chomp;
my ($sha1, $ref, $deref) = /^(\S+)\s+([^^]+)(\S*)$/;
- my ($pattern);
next unless ($sha1 eq $headrev);
- $pattern="/$head\$";
if ($ref eq $head) {
$found = $ref;
}
- if ($ref =~ /$pattern/) {
+ if ($ref =~ $pattern) {
$found = $ref;
}
if ($sha1 eq $head) {