Kaydet (Commit) fc6773d6 authored tarafından Veli-Matti Lintu's avatar Veli-Matti Lintu Kaydeden (comit) Joffrey F

Commit d798afca made changes for the handling of '**' patterns in

.dockerignore. This causes an IndexError with patterns ending
with '**', e.g. 'subdir/**'. This adds a missing boundary check
before checking for trailing '/'.
Signed-off-by: 's avatarVeli-Matti Lintu <veli-matti.lintu@nosto.com>
üst ba7580d6
......@@ -75,7 +75,7 @@ def translate(pat):
# is some flavor of "**"
i = i + 1
# Treat **/ as ** so eat the "/"
if pat[i] == '/':
if i < n and pat[i] == '/':
i = i + 1
if i >= n:
# is "**EOF" - to align with .gitignore just accept all
......
......@@ -874,6 +874,23 @@ class ExcludePathsTest(unittest.TestCase):
)
)
def test_trailing_double_wildcard(self):
assert self.exclude(['subdir/**']) == convert_paths(
self.all_paths - set(
['subdir/file.txt',
'subdir/target/file.txt',
'subdir/target/subdir/file.txt',
'subdir/subdir2/file.txt',
'subdir/subdir2/target/file.txt',
'subdir/subdir2/target/subdir/file.txt',
'subdir/target',
'subdir/target/subdir',
'subdir/subdir2',
'subdir/subdir2/target',
'subdir/subdir2/target/subdir']
)
)
class TarTest(unittest.TestCase):
def test_tar_with_excludes(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment