summaryrefslogtreecommitdiff
path: root/t/t5150-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 /t/t5150-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 't/t5150-request-pull.sh')
-rwxr-xr-xt/t5150-request-pull.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
index fca001e..c1a821a 100755
--- a/t/t5150-request-pull.sh
+++ b/t/t5150-request-pull.sh
@@ -246,4 +246,22 @@ test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
'
+test_expect_success 'request-pull quotes regex metacharacters properly' '
+
+ rm -fr downstream.git &&
+ git init --bare downstream.git &&
+ (
+ cd local &&
+ git checkout initial &&
+ git merge --ff-only master &&
+ git tag -mrelease v2.0 &&
+ git push origin refs/tags/v2.0:refs/tags/v2-0 &&
+ test_must_fail git request-pull initial "$downstream_url" tags/v2.0 \
+ 2>../err
+ ) &&
+ grep "No match for commit .*" err &&
+ grep "Are you sure you pushed" err
+
+'
+
test_done