mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
ci(tools): Fix worktree submodule copy of gitlink files
This commit is contained in:
@@ -70,10 +70,11 @@ def _create_idf_copy_via_worktree(path_from: Path, path_to: Path) -> str:
|
|||||||
# Only copy if source submodule exists and has content
|
# Only copy if source submodule exists and has content
|
||||||
if src_submodule.exists() and any(src_submodule.iterdir()):
|
if src_submodule.exists() and any(src_submodule.iterdir()):
|
||||||
logging.debug(f'copying submodule {submodule_rel_path}')
|
logging.debug(f'copying submodule {submodule_rel_path}')
|
||||||
# Remove the empty directory created by worktree
|
# Worktree submodule paths may be gitlink files; rmtree() does not remove those.
|
||||||
if dst_submodule.exists():
|
if dst_submodule.is_file() or dst_submodule.is_symlink():
|
||||||
shutil.rmtree(dst_submodule, ignore_errors=True)
|
dst_submodule.unlink()
|
||||||
# Copy the submodule content
|
elif dst_submodule.exists():
|
||||||
|
shutil.rmtree(dst_submodule)
|
||||||
shutil.copytree(src_submodule, dst_submodule, symlinks=True, ignore=shutil.ignore_patterns('.git'))
|
shutil.copytree(src_submodule, dst_submodule, symlinks=True, ignore=shutil.ignore_patterns('.git'))
|
||||||
|
|
||||||
# Match old shutil-based idf_copy: no top-level .git (see docstring above).
|
# Match old shutil-based idf_copy: no top-level .git (see docstring above).
|
||||||
|
|||||||
Reference in New Issue
Block a user