uid = int(os.getenv("SUDO_UID", 0))
c = run(["git", "-C", src, "ls-files", "-z", *what_files], stdout=PIPE, text=False, user=uid)
- files = {x.decode("utf-8") for x in c.stdout.rstrip(b"\0").split(b"\0")}
+ files: Set[str] = {x.decode("utf-8") for x in c.stdout.rstrip(b"\0").split(b"\0")}
# Add the .git/ directory in as well.
if source_file_transfer == SourceFileTransfer.copy_git_more:
files -= submodules
for sm in submodules:
+ sm = Path(sm)
c = run(
- ["git", "-C", os.path.join(src, sm), "ls-files", "-z"] + what_files,
+ ["git", "-C", src / sm, "ls-files", "-z"] + what_files,
stdout=PIPE,
text=False,
user=uid,
)
- files |= {os.path.join(sm, x.decode("utf-8")) for x in c.stdout.rstrip(b"\0").split(b"\0")}
+ files |= {sm / x.decode("utf-8") for x in c.stdout.rstrip(b"\0").split(b"\0")}
files -= submodules
del c
for path in files:
- src_path = os.path.join(src, path)
- dest_path = os.path.join(dest, path)
+ src_path = src / path
+ dest_path = dest / path
- directory = os.path.dirname(dest_path)
- os.makedirs(directory, exist_ok=True)
+ dest_path.parent.mkdir(parents=True, exist_ok=True)
copy_file(src_path, dest_path)