fix(plugin): git_clone でシェル CWD 削除時の失敗を回避#16
Merged
Conversation
シェルのカレントディレクトリが削除された状態で `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) <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
devbase plugin update実行時、シェルのカレントディレクトリが削除された状態でgetcwd()が ENOENT を返すと、git_clone()内のsubprocess.run(['git', 'clone', ...])が無効な CWD を継承し、git-remote-httpsヘルパの起動で落ちていたsubprocess.run(..., cwd=str(dest.parent))を明示し、Python (= 親シェル) の CWD に依存しないようにするdest.parent.mkdir(parents=True, exist_ok=True)を追加し、cwd 用パスの存在を保証再現エラー
シェルが既に削除されたディレクトリ (
carmo-system-console) に居る状態でdevbase plugin updateを実行すると、複数のgit cloneが同上で失敗する。検証
Test plan
cwd=未指定) で当該エラーが再現することをローカル確認cwd=str(dest.parent)) で同条件でもgit cloneが成功することを確認devbase plugin install/devbase plugin updateが回帰しないこと (本リポジトリにはテストスイートが無いため目視)🤖 Generated with Claude Code