Skip to content

Handle empty dir in VCS type detection instead of crashing - #1704

Open
ZoomRmc wants to merge 1 commit into
nim-lang:masterfrom
ZoomRmc:zvcstypenone
Open

Handle empty dir in VCS type detection instead of crashing#1704
ZoomRmc wants to merge 1 commit into
nim-lang:masterfrom
ZoomRmc:zvcstypenone

Conversation

@ZoomRmc

@ZoomRmc ZoomRmc commented May 15, 2026

Copy link
Copy Markdown
Contributor

When a dependency is referenced via --path (nim.cfg) and is not installed in nimble pkgs2, nimble creates a PackageInfo with an empty myPath. Calling getVcsType or getVcsTypeAndSpecialDirPath with this empty path raises an uncaught NimbleError, preventing nimble dump from producing output and breaking LSP integration.

This fixes by returning (vcsTypeNone, "") for empty dir. An empty dir means "path unknown" - no VCS to detect. All callers handle vcsTypeNone gracefully already. Non-empty non-existent dirs (e.g. corrupted cache) still raise as before.

When a dependency is referenced via `--path` (nim.cfg) and is not
installed in nimble pkgs2, nimble creates a PackageInfo with an
empty `myPath`. Calling `getVcsType` or `getVcsTypeAndSpecialDirPath`
with this empty path raises an uncaught NimbleError, preventing
`nimble dump` from producing output and breaking LSP integration.

This fixes by returning `(vcsTypeNone, "")` for empty dir. An empty dir means
"path unknown" - no VCS to detect. All callers handle `vcsTypeNone`
gracefully already. Non-empty non-existent dirs (e.g. corrupted cache)
still raise as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant