summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormefyl <quentin.hocquet@docker.com>2018-02-19 12:54:04 +0100
committermefyl <quentin.hocquet@docker.com>2018-02-21 17:05:27 +0100
commit0c948c7df65b0d7378c3c0c8d966c38171f1ef21 (patch)
tree9407032c18c28e53a6a13e382a956353dbfc79b4
parent3b464f983e77cf85d9bc91e6f725cd7773bc0871 (diff)
downloaddocker-py-0c948c7df65b0d7378c3c0c8d966c38171f1ef21.tar.gz
Add note about potential dockerignore optimization.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
-rw-r--r--docker/utils/build.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/docker/utils/build.py b/docker/utils/build.py
index 09b2071..1da56fb 100644
--- a/docker/utils/build.py
+++ b/docker/utils/build.py
@@ -95,6 +95,15 @@ def walk(root, patterns, default=True):
# be included.
if all(not p[0] for p in sub) and not matched:
continue
+ # I think this would greatly speed up dockerignore handling by not
+ # recursing into directories we are sure would be entirely
+ # included, and only yielding the directory itself, which will be
+ # recursively archived anyway. However the current unit test expect
+ # the full list of subfiles and I'm not 100% sure it would make no
+ # difference yet.
+ # if all(p[0] for p in sub) and matched:
+ # yield f
+ # continue
children = False
for r in (os.path.join(f, p) for p in walk(cur, sub, matched)):
yield r