From e4579eef9eb077e42f9547f27fe93499fcf1cde6 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Fri, 22 May 2026 07:41:59 +0900 Subject: [PATCH] =?UTF-8?q?fix(plugin):=20git=5Fclone=20=E3=81=A7=E3=82=B7?= =?UTF-8?q?=E3=82=A7=E3=83=AB=20CWD=20=E5=89=8A=E9=99=A4=E6=99=82=E3=81=AE?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=82=92=E5=9B=9E=E9=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit シェルのカレントディレクトリが削除された状態で `devbase plugin update` を 実行すると、Python から `git clone` を呼ぶ際に無効な CWD を継承し、 git-remote-https ヘルパが起動時に getcwd() ENOENT で落ちていた: fatal: Unable to read current working directory: No such file or directory fatal: remote helper 'https' aborted session `git_clone()` で subprocess.run() に `cwd=dest.parent` を明示し、 親プロセスの CWD に依存しないようにする。`dest.parent.mkdir(parents=True, exist_ok=True)` で cwd 用ディレクトリの存在も保証する。 Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/devbase/plugin/installer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/devbase/plugin/installer.py b/lib/devbase/plugin/installer.py index 8f0ee6c..8a1d715 100644 --- a/lib/devbase/plugin/installer.py +++ b/lib/devbase/plugin/installer.py @@ -55,8 +55,11 @@ def git_clone(url: str, dest: Path, ref: Optional[str] = None) -> None: if ref: cmd.extend(['--branch', ref]) cmd.extend([url, str(dest)]) + dest.parent.mkdir(parents=True, exist_ok=True) try: - subprocess.run(cmd, check=True, capture_output=True, text=True) + subprocess.run( + cmd, check=True, capture_output=True, text=True, cwd=str(dest.parent), + ) except subprocess.CalledProcessError as e: raise PluginError(f"git clone failed for {url}: {e.stderr.strip()}")