Support SCP-like parent URLs with relative submodules

Open
#492 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
git, go
Domain
devtools

Research direction

Start by locating ResolveSubmoduleURL and the existing scpLikeURLRegex. Read the relative-path handling and compare it with go-git's transport.NewEndpoint() behavior, then add coverage for SCP-like parent URLs and relative submodule paths. Done means the reported URL resolves without the current error while existing HTTPS and multiple-relative-path cases continue to work.

Written by the indexing model from the issue text.

Description

envbuilder Feature

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
Dominant language
Go
Stars
300
Forks
64
Avg merge
20m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coder/envbuilder

All issues in coder/envbuilder

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.