8000 fix(merge): fold specs deriving the same plugin name (#39) by zuqini · Pull Request #40 · zuqini/zpack.nvim · GitHub
[go: up one dir, main page]

Skip to content

fix(merge): fold specs deriving the same plugin name (#39) - #40

Merged
zuqini merged 1 commit into
mainfrom
mason-src-conflict-39
Sep 22, 2026
Merged

zuqini merged 1 commit into
mainfrom
mason-src-conflict-39

Conversation

@zuqini
@zuqini zuqini commented Sep 21, 2026 •
Copy link
Copy Markdown
Owner

vim.pack.add aborts with Conflicting `src` when two specs in one call derive the same plugin name from different URLs. zpack keyed the spec registry by normalized source, so a config referencing a plugin under both its old and new GitHub owner — e.g. mason-org/mason.nvim at top level and williamboman/mason.nvim in another plugin's dependencies — produced two mason.nvim entries and a hard setup() failure. lazy.nvim keys plugins by derived name and silently lets the last fragment's URL win, so the same config worked there.

  • Group the coalesce fold by derived plugin name instead of [1] shorthand URL, replacing the shorthand special case. Same-[1] override folds behave as before; folds that join entries naming no repo in common (a shared [1], or a src/url equal to the other's [1]) emit one WARN naming both sources and the winner.
  • Precedence among folded entries: explicit src/url/dir > top-level spec > dependency-only spec, latest import within a tier; dev precedence unchanged.
  • name = '...' still keeps deliberately distinct plugins apart.
  • Tests for the mason shape in both import orders, name escape hatch, and no-warn on fork overrides; docs note under name.

Behavior change to be aware of: { 'user/repo', name = 'x', url = fork } + { 'user/repo', keys = ... } previously folded into one plugin; they now resolve to x and repo and stay separate, as in lazy.nvim (where name is the plugin's identity). No user report depends on the old behavior; the docs under name describe the new one.

Closes #39
Implements bead zpack_nvim-3wn (close on merge).

@zuqini
zuqini force-pushed the mason-src-conflict-39 branch 4 times, most recently from f8e3690 to f416f56 Compare September 21, 2026 23:16
Two specs that derive the same name from different owners (e.g.
`williamboman/mason.nvim` in a dependencies list and
`mason-org/mason.nvim` at top level) survived import as separate registry
entries and vim.pack.add aborted setup() with a conflicting-src error.

Group registry entries by the name their merged spec resolves to — the
exact name handed to vim.pack — and fold each group into one entry. The
same-`[1]` override case is a subset, so this replaces the shorthand
special case rather than adding a second pass. Keying on the entry's
resolved name (not on every `[1]` or basename a fragment carries) keeps
the fold set equal to the conflict set: a `{ 'user/repo', name = 'alias' }`
entry no longer swallows an unrelated `other/repo`, and a `[1]`-less
fragment of a fork no longer lends the fork's basename to the fold. Since
every entry resolves to exactly one name, a single pass suffices. The
chained-`[1]` fixpoint fold is dropped with it: lazy.nvim keeps `a` and
`b` as two plugins for that shape, so converging them was itself
non-parity (fragment identity on a src-keyed registry is zpack_nvim-3wn).

Entries rank as a (tier, import order) pair: an explicit src/url/dir
fragment beats a bare top-level one, which beats a dependency-only one;
the latest-imported wins within a tier. lazy.nvim is pure
later-fragment-wins; the tiers are a deliberate divergence so the winner
does not depend on plugin-file import order. A fold that joins entries
naming no repo in common — a shared `[1]`, or a src/url equal to the
other's `[1]` — emits one WARN naming both sources and the winner.
`name` on one fragment keeps it apart from same-`[1]` fragments, as in
lazy.nvim. Folded fragments merge fields as usual, so `enabled = false`
on either owner disables the plugin.

Document the fold and its precedence under `name`.

Closes #39
@zuqini
zuqini force-pushed the mason-src-conflict-39 branch from f416f56 to c14ee9f Compare September 21, 2026 23:40
@zuqini
zuqini merged commit 892385a into main Sep 22, 2026
4 checks passed
@zuqini
zuqini deleted the mason-src-conflict-39 branch September 22, 2026 06:23
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.

Mason src conflict

1 participant

0