Fix push when --out contains the wiki clone directory.
Keep wiki_clone* across convert --clean and skip copying the clone into itself (0.3.5). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -126,12 +126,21 @@ def push_wiki(
|
||||
for src in content_dir.iterdir():
|
||||
if src.name == ".git":
|
||||
continue
|
||||
# -o pointed at parent of the clone: do not copy the clone into itself
|
||||
try:
|
||||
if src.resolve() == work_dir.resolve():
|
||||
continue
|
||||
src.resolve().relative_to(work_dir.resolve())
|
||||
continue # src is inside work_dir
|
||||
except ValueError:
|
||||
pass
|
||||
dst = work_dir / src.name
|
||||
if src.is_dir():
|
||||
if dst.exists():
|
||||
shutil.rmtree(dst)
|
||||
shutil.copytree(src, dst)
|
||||
else:
|
||||
dst.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(src, dst)
|
||||
|
||||
_run(["git", "add", "-A"], cwd=work_dir)
|
||||
|
||||
Reference in New Issue
Block a user