-
Notifications
You must be signed in to change notification settings - Fork 46
Labels
acceptedDirection approved, safe to start workDirection approved, safe to start workbugSomething isn't workingSomething isn't working
Description
Bug
Running apm install twice in succession fails on all subdirectory (monorepo) packages during the second run.
Steps to reproduce
- Start with a clean project (no
apm_modules/, noapm.lock) - Run
apm install --trust-transitive-mcp— succeeds, generatesapm.lock - Run
apm install --trust-transitive-mcpagain — all subdirectory packages fail with:fatal: Remote branch <commit-sha> not found in upstream origin
Root cause
When the lockfile exists, the install logic appends the locked commit SHA as a git reference (#<sha>) to the download ref string. For subdirectory packages, download_subdirectory_package passes this SHA as branch=<sha> with depth=1 to git clone. Git shallow clones (--depth=1 --branch=X) only accept branch/tag names, not arbitrary commit SHAs — so every package fails.
Expected behavior
Repeated apm install should be idempotent — the second run should produce the same result as the first.
Fix
Detect when the ref is a commit SHA in download_subdirectory_package and use a full clone + checkout instead of --depth=1 --branch=<sha>.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
acceptedDirection approved, safe to start workDirection approved, safe to start workbugSomething isn't workingSomething isn't working