coder / coder/envbuilder

Support SCP-like parent URLs with relative submodules

Abierto
#492 0 comentarios 0 reacciones 0 asignados Ver en GitHub
envbuilder Feature
Lenguaje dominante
Go
Estrellas
300
Forks
64
Merge medio
20 min
PR fusionados (30 d)
1

Descripción

## 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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza localizando ResolveSubmoduleURL y el scpLikeURLRegex existente. Lee el manejo de rutas relativas y compáralo con el comportamiento de transport.NewEndpoint() de go-git; después, añade cobertura para URLs padre similares a SCP y rutas relativas de submódulos. La tarea estará terminada cuando la URL indicada se resuelva sin el error actual y los casos existentes de HTTPS y de múltiples rutas relativas sigan funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
git, go
Área
devtools
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
56/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.