Improve extra_files override check

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2018-03-27 10:22:17 -07:00 committed by Joffrey F
parent fce99c329f
commit f39c0dc18d
1 changed files with 2 additions and 1 deletions

View File

@ -152,8 +152,9 @@ def create_archive(root, files=None, fileobj=None, gzip=False,
t = tarfile.open(mode='w:gz' if gzip else 'w', fileobj=fileobj)
if files is None:
files = build_file_list(root)
extra_names = set(e[0] for e in extra_files)
for path in files:
if path in [e[0] for e in extra_files]:
if path in extra_names:
# Extra files override context files with the same name
continue
full_path = os.path.join(root, path)