Repository navigation
fix(utils): allow non-GitHub URLs while still expanding the short form GitHub owner/repo paths - #42
Merged
Merged
Conversation
Owner
|
LGTM, thank you! Should note for posterity that this PR is for automatically inferring the URL from the positional argument [1], not conflicting with the existing |
zuqini
added a commit
that referenced
this pull request
Sep 25, 2026
#42 passed `[1]` values starting with `/`, `~`, or `.` through unchanged, but vim.pack hands `src` to `git clone` verbatim: `{ '~/repo' }` fails with "repository '~/repo' does not exist", and `{ './repo' }` resolves against whatever directory nvim was started from. `{ dir = '~/repo' }` already covers local checkouts and is `vim.fn.expand`ed, so `[1]` now passes through only URL-shaped values (any `scheme://` and scp-style `user@host:`); anything else is `owner/repo` shorthand. This is exactly lazy.nvim's rule, which has no local-path branch for `[1]` at all. `/abs` in `[1]` never worked in a released version, so nothing depends on it. Pin the reported bug end to end: a full URL in `[1]` registers under that URL instead of `https://github.com/https://...`. Pin the shorthand outcome for `~`, `./` and `/` with exact assertions instead of `~=`; the old test passed for any transformation, including a future expansion branch.
zuqini
added a commit
that referenced
this pull request
Sep 25, 2026
`[1]` still read as "always expands to github.com" in the vimdoc, spec.md, and the LuaLS field annotation after #42 made full URLs pass through. State the split at each site: `owner/repo` expands, a full git URL (any `scheme://` or scp-style `user@host:`) is used as-is, and local checkouts go through `dir`. Make `dir` read as the local-checkout field rather than a compat alias, and note on `src` that it is passed to git verbatim, so `~` is not expanded there either. Otherwise a reader scanning the field list sees `src` = "local path, highest priority" and `dir` = "compat shim" and picks the one that does not expand.
zuqini
added a commit
that referenced
this pull request
Sep 25, 2026
Since #42 a `[1]` value may be a full URL and is matched before any concatenation, so the fold_rank and normalize_source comments described a shape that no longer exists.
zuqini
added a commit
that referenced
this pull request
Sep 25, 2026
`[1]` still read as "always expands to github.com" in the vimdoc, spec.md, and the LuaLS field annotation after #42 made full URLs pass through. State the split at each site: `owner/repo` expands, a full git URL (any `scheme://` or scp-style `user@host:`) is used as-is, and local checkouts go through `dir`. Make `dir` read as the local-checkout field rather than a compat alias, and note on `src` that it is passed to git verbatim, so `~` is not expanded there either. Otherwise a reader scanning the field list sees `src` = "local path, highest priority" and `dir` = "compat shim" and picks the one that does not expand.
zuqini
added a commit
that referenced
this pull request
Sep 25, 2026
Since #42 a `[1]` value may be a full URL and is matched before any concatenation, so the fold_rank and normalize_source comments described a shape that no longer exists.
zuqini
added a commit
that referenced
this pull request
Sep 25, 2026
…ate (#44) Follow-ups to #42, which let a full git URL in `[1]` pass through instead of being prefixed with `https://github.com/`. #42 also passed `[1]` values starting with `~`, `.` or `/` through unchanged, but vim.pack hands `src` to `git clone` verbatim: `{ '~/repo' }` fails with "repository '~/repo' does not exist", and `{ './repo' }` resolves against whatever directory nvim was started from. `{ dir = '~/repo' }` already covers local checkouts and is `vim.fn.expand`ed, so `[1]` now passes through only URL-shaped values (any `scheme://` and scp-style `user@host:`); anything else is treated as `owner/repo` shorthand. This is exactly lazy.nvim's rule, which has no local-path branch for `[1]` at all. Because `{ '~/repo' }` would otherwise fail with an equally unhelpful "github.com/~/repo not found", `validate_spec` now flags a `[1]` starting with `~`, `.` or `/` with "looks like a local path — use dir". Advisory only, like every other spec check, and only when no explicit `src`/`url`/`dir` is set — with one of those present `[1]` just feeds the name and never reaches git. A `dev = true` spec is skipped too: it loads from `dev.path`, and `[1]` reaches git only under `dev.fallback = true` with a missing checkout, which validate cannot see. Also: - end-to-end regression test for the #42 bug (a full URL in `[1]` registers under that URL, name derives from its basename) - exact-value unit tests pinning that `~/`, `./` and `/` in `[1]` become shorthand - docs aligned at every site (vimdoc `[1]`/spec block/dependencies note, `docs/spec.md`, LuaLS `zpack.Spec` annotation): `owner/repo` expands to GitHub, a full git URL is used as-is, use `dir` for local paths - `dir` docs lead as the local-checkout field instead of a compat alias; `src` docs note that it is passed to git verbatim, so `~` is not expanded there either — use `dir` - stale comments that assumed `[1]` is always shorthand; test data uses `example.com` hosts Refs #42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Specs like
{ 'https://forge.example.com/owner/repo' }were expanded tohttps://github.com/https://forge.example.com/owner/repo, causingvim.packto fail withrepository not found.github_urlnow returns full URLs (any scheme), scp-stylegit@host:pathand local paths (/,~,.) unchanged, and only expandsowner/reposhorthand to GitHub.Tests added in
tests/utils_test.luaand all pass.