summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2020-04-17 11:10:23 +0200
committerGuido Günther <agx@sigxcpu.org>2020-04-17 11:45:48 +0200
commit74b37991deb075b948a9ce1e1a9d1fd03091c59e (patch)
treefc9e6129ad4524904869ab8b831977c7ee64318a
parent3b05fa8349d937b005463b4e1344421499a2483f (diff)
pristine-tar: Escape '+' in match regexp
When looking for matching file name we need to exscape the valid '+' but need to do it late since it must not be escaped for git-grep. Closes: #956103
-rw-r--r--gbp/pkg/pristinetar.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py
index e8534076..d1a61e40 100644
--- a/gbp/pkg/pristinetar.py
+++ b/gbp/pkg/pristinetar.py
@@ -68,7 +68,9 @@ class PristineTar(Command):
def _commit_contains_file(self, commit, regexp):
"""Does the given commit contain a file with the given regex"""
files = self.repo.get_commit_info(commit)['files']
- cregex = re.compile(regexp)
+ # CPython wants '+' (which is valid in source package names)
+ # escaped but git-grep doesn't so we do it that late:
+ cregex = re.compile(regexp.replace('+', '\\+'))
for _, v in files.items():
for f in v:
if cregex.match(f.decode()):