Skip to content

fix: support ssh:// protocol URLs and detect unreplaced template variables - #7

Merged
tosaka07 merged 3 commits into
mainfrom
fix/template-dir
Feb 13, 2026
Merged

fix: support ssh:// protocol URLs and detect unreplaced template variables#7
tosaka07 merged 3 commits into
mainfrom
fix/template-dir

Conversation

@tosaka07

Copy link
Copy Markdown
Owner

Summary

  • RepoInfo::from_url()ssh:// および git:// プロトコル URL をパースできるよう修正。ssh://git@github.com/owner/repo.git のような URL で {host}, {owner}, {repository} テンプレート変数が未置換のままディレクトリ名になっていた問題を解消
  • generate_worktree_name()Result 返却に変更し、テンプレート変数が未置換のまま残った場合にエラーメッセージを表示する安全策を追加

Test plan

  • cargo clippy -- -D warnings pass
  • cargo test pass (226 tests)
  • ssh://git@host/owner/repo.git 形式の URL パーステスト追加
  • ssh://host:port/owner/repo.git ポート付き URL テスト追加
  • git://host/owner/repo.git git プロトコル URL テスト追加
  • 未置換テンプレート変数検出のエラーテスト追加
  • file:// や空文字列等のエッジケーステスト追加

RepoInfo::from_url() only handled SCP-like (git@host:path) and
HTTPS URLs, causing ssh:// protocol URLs like
ssh://git@github.com/owner/repo.git to return None.
This left template variables ({host}, {owner}, {repository})
unreplaced, creating literal directory names.
Change generate_worktree_name() to return Result and error when
template variables like {host}, {owner}, {repository} remain
unreplaced after substitution. This prevents silent creation of
literal directory names when repo info is unavailable.
@tosaka07 tosaka07 added the bug Something isn't working label Feb 13, 2026
@tosaka07
tosaka07 marked this pull request as ready for review February 13, 2026 03:58
- bytes 1.11.0 -> 1.11.1 (RUSTSEC-2026-0007: integer overflow)
- time 0.3.46 -> 0.3.47 (RUSTSEC-2026-0009: stack exhaustion DoS)
- git2 0.20.3 -> 0.20.4 (RUSTSEC-2026-0008: undefined behavior)
@tosaka07
tosaka07 merged commit 7ab53cc into main Feb 13, 2026
5 checks passed
@tosaka07
tosaka07 deleted the fix/template-dir branch February 13, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant