Repository navigation
Install: show invalid ref and pin errors instead of Unknown error - #357
Conversation
explainGitError rewrote every error. Invalid refs and lockfile pins came out as 'Failed to clone ...: Unknown error', and a missing tag on GitHub/GitLab as 'repository not accessible'. Only a failed git process (cmd / code set) is explained now; capa's own messages pass through.
PR Summary by QodoPreserve actionable git ref and lockfile pin errors during install
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
explainGitError told git failures from capa's own errors by the cmd / code properties execFile sets. That shape depends on the runtime, so git() now records the errors it rejects with and the wrapper checks that.
Summary
Found while verifying the v2.4.0 release (#351) locally. The ref checks from #317 and the lockfile pin check from #352 throw clear errors, but install showed
Failed to clone <url>: Unknown errorinstead. On GitHub and GitLab, a missing tag or pinned commit was also reported as "repository not accessible".What changed
explainGitError(install-tasks/helpers/git.ts) rewrote every error it got. Errors without afatal:/error:line became "Unknown error", and on GitHub/GitLab anything containing "not found" became "repository not accessible". Capa's own cache errors (invalid ref or pin, missing tag or commit, tampered mirror) now pass through as they are. Only an error from running git is explained.git()inshared/cache/git-cli.ts, which runs every git command in the cache, records the errors it rejects with, andisGitProcessErrorchecks that. This doesn't rely on the shape of the error, which differs between runtimes and platforms.Screenshots / logs
Release build, before and after:
version: main@{1}Failed to clone https://github.com/…: Unknown errorInvalid version "main@{1}": use a tag, branch or commit SHA (…)resolvedRef: mainincapabilities.lockFailed to clone https://github.com/…: Unknown errorInvalid pinned commit "main" in capabilities.lock: expected a commit SHA. Remove the entry or run "capa install --no-cache" to re-pin.version: v99.99.99GitHub repository not accessible: …Tag/branch "v99.99.99" not found in repository at …Test plan
githubandgit(this fails without the fix); errors that come out ofgit()(a failed command, and git missing) are still explained.bunx tsc --noEmit; CLI and shared suites have no assertion failures (only the known Windows EBUSY/EPERM temp cleanup).Checklist
bunx tsc --noEmitpasses🤖 Generated with Claude Code