Repository navigation
Description
Problem
Split from #239 (§1). skillshare install never resolves git submodules. When a hub repo mounts an upstream skill as a submodule (gitlink, mode 160000), the result depends on how the source is written, and one case succeeds silently with nothing in it:
| Source | What happens today |
|---|---|
| Whole hub (discovery) | Shallow clone leaves the gitlink as an empty dir; discoverSkills finds no SKILL.md there, so the submodule's skills silently disappear from the picker |
| Subdir = the gitlink itself | Sparse checkout succeeds with an empty directory; os.Stat passes, copyDir copies nothing, checkSkillFile only appends the warning no SKILL.md found in skill directory — install reports success |
| Subdir inside the submodule | subdirectory missing after checkout → API fallback → full clone → subdirectory '...' does not exist in repository |
--track hub |
Clone succeeds, gitlink stays empty, later git pull never updates it |
The Contents API fallbacks do not help: GitHub only handles dir/file, Gitea skips other types, CNB explicitly ignores submodule entries.
Evidence (v0.25.0, aeaea40e)
- No
--recurse-submodules/submodule updateanywhere underinternal/install internal/install/install_apply.go:518-522sparse fast path,:641-645warn-onlycheckSkillFileinternal/install/sparse_checkout.go:46-69internal/install/gitea_download.go:399-400("Ignore links and submodules")website/docs/how-to/advanced/migration.mdonly covers migrating from submodules, not hub authors using them
Proposal
Phase 1 (S) — detect and fail loudly. After checkout, run git ls-tree -r -d HEAD and check whether the requested path is a gitlink or sits under one. If so, return an explicit error naming the submodule path, its upstream URL (from .gitmodules) and pinned commit, and suggest installing the upstream directly or vendoring it into the hub. During whole-repo discovery, warn for each gitlink skipped. Document the limitation in install.md.
Phase 2 (M) — scoped resolution for non-tracked install/update. Run git submodule update --init --depth 1 -- <path> only for gitlinks that intersect the requested path, fall back to a full fetch when the server refuses a depth-1 fetch of a pinned SHA, no --recursive, reuse the existing same-host insteadOf auth env. Verified with plain git that this works inside a sparse checkout for all three path shapes above.
Not in scope
- Tracked repos and cross-host private sub-repo auth (later phase)
- A
vendor sync/ lockfile command —git subtreeor CI already covers it on the hub side - Reading
.gitmodulesand re-entering the install flow with the sub-URL (alternative; revisit only if cross-host auth or large upstreams become a real need)
Open questions before Phase 2
- Real-host behaviour of
--filter=blob:none+ shallow submodule fetch of a pinned SHA (GitHub / GitLab / Gitea) - GitHub Contents API response for a submodule entry (assumed
type: filewithoutdownload_url, unverified) - Whether metadata
sourcefor a skill inside a submodule records the hub path or the upstream path (tree_hashis empty for paths inside a submodule, soupdatemust compare commits) - Minimum git version gate (≥ 2.45.1, CVE-2024-32002)
Activity
fix(install): warn about submodules on tracked updates
fix(install): refuse git submodule paths instead of installing empty …