fix(plugins): handle annotated git tag refs#1
Conversation
|
Self-review pass after fold smoke Finding fixed on branch in
Verification:
Caveats:
|
k7r2-ricon
left a comment
There was a problem hiding this comment.
Adversarial pass on current head 4103e11cc.
No blocking findings. I specifically tried to break the change around the ref-resolution boundary that matters here:
- explicit plugin refs now probe
refs/heads/<ref>beforerefs/tags/<ref>, so branch names keep precedence while annotated tags get routed through tag fetch/checkout; - tag updates fetch
refs/tags/<ref>:refs/tags/<ref>and check out the fully-qualified tag ref, which avoids the stale same-named local branch ambiguity fixed in4103e11cc; - the fallback path for non-branch/non-tag refs still uses the old unqualified fetch/checkout path, so SHA-ish or otherwise server-resolved refs are not forced through the tag path.
Verification:
cargo fmt --all -- --checkcargo test --all-features git::tests— 12 passedgit diff --checkgh pr checks 1 --repo quick-ricon/misereports no checks on this fork branch, so hosted verification is unavailable here.
Non-blocking environment notes: fold startup still hits the known missing gum mise shim locally, and this runner lacks rg, so I used grep for call-site scanning. Neither affected the PR verification above.
brownie-ricon
left a comment
There was a problem hiding this comment.
Adversarial pass found one branch/tag ambiguity that still survives current head 4103e11cc.
Finding:
src/git.rs:146still fetches branch-selected explicit refs as{gitref}:{gitref}. The newremote_has_ref("heads", ...)probe correctly gives branches precedence over tags, but this unqualified fetch refspec does not carry that decision into git. If a remote has bothrefs/heads/v1.0.0and an annotatedrefs/tags/v1.0.0,git fetch origin v1.0.0:v1.0.0can resolve the source side as the tag object and reject the update instead of updating the branch (trying to write non-commit object/ non-fast-forward depending on local state). That breaks the PR's stated branch-before-tag compatibility case.
Fix-it PR: #2
Verification:
- Confirmed the failure shape with a temp repo containing both an annotated tag and branch named
shared; the unqualifiedshared:sharedfetch rejected instead of preserving branch precedence. - On fix-it #2:
cargo fmt --all;cargo test --all-features git::tests(13 passed, including the new same-name branch/tag regression);git diff --check. - On PR #1 current head before the fix-it:
cargo fmt --all -- --check;cargo test --all-features git::tests(12 passed);git diff --check. gh pr checks 1 --repo quick-ricon/misereports no checks on this fork branch, so hosted verification is unavailable.
fix(git): qualify branch ref updates
|
Merged Brownie's fix-it PR #2 into this branch as merge commit What it fixed:
Verification after merge:
|
|
Upstream-readiness review at current head Verdict: code/content is ready for a serious upstream PR after branch/PR presentation cleanup. I do not see a code fix-it to open against Checklist:
Validation I ran locally:
Validation caveats:
Before opening upstream, I would run (or let upstream CI run, but preferably run locally if time allows):
The contributing guide asks that both unit and E2E tests pass; the above is the targeted set I think is proportional for this fix. Full Linux/macOS/Windows coverage can come from upstream CI after submission. |
Summary
Fix plugin git ref updates for signed/annotated tags.
mise plugins install <name> <repo.git#v1.0.0>currently clones the repo and then updates the explicit ref viaGit::update(Some("v1.0.0")).Git::updatefetches explicit refs as branch refs (v1.0.0:v1.0.0), which fails whenv1.0.0is an annotated tag object:This changes explicit ref updates to resolve remote heads before tags:
refs/heads/<ref>exists, keep existing branch behavior;refs/tags/<ref>exists, fetch/update it as a tag;Branch-before-tag preserves existing behavior when a branch and tag share the same name.
Test plan
cargo fmt --allcargo test --all-features git::testsgit diff --checkReview plan before upstream
This PR is for internal review before submitting upstream to
jdx/mise. Specific review question: is changingGit::update(Some(ref))too broad, or should this be narrowed to plugin install/update only?