coder / coder/envbuilder

Support SCP-like parent URLs with relative submodules

オープン
#492 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
envbuilder Feature
主要言語
Go
スター
300
フォーク
64
平均マージ
20分
マージ済み PR(30日)
1

説明

## Problem

When the parent repository uses an SCP-like URL (e.g., `git@github.com:org/repo.git`) and a submodule is configured with a relative path (e.g., `../other/submodule.git`), envbuilder cannot resolve the submodule URL.

Currently this returns an error:
```
relative submodule URL "../other/submodule.git" cannot be resolved: parent URL "git@github.com:org/repo.git" uses SCP-like syntax which is not supported for relative submodule resolution
```

## Background

Go's `net/url.Parse()` cannot properly parse SCP-like URLs - they have no scheme and use `:` as a path separator instead of `/`.

We've built a custom `ResolveSubmoduleURL` function to handle relative submodule paths because go-git's native implementation has bugs with:
- HTTPS URLs losing slashes when using `filepath.Dir()`
- Multiple relative paths (`../../submodule.git`) not resolving correctly

## Workaround

Users can configure submodules with absolute URLs instead of relative paths.

## Proposed Solution

Add SCP-like URL handling to `ResolveSubmoduleURL`:
1. Detect SCP-like parent URLs using the existing `scpLikeURLRegex`
2. Parse into user, host, and path components
3. Apply relative path resolution to the path component
4. Reconstruct the SCP-like URL

Alternatively, use go-git's `transport.NewEndpoint()` which can parse SCP-like URLs, but this needs careful testing to ensure it doesn't reintroduce the bugs we worked around.

## Related/Blocker

- PR #485: feat: add git submodule support

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。