Skip to content

fix: honor --pin when --force is specified on extension install#13602

Open
AruneshDwivedi wants to merge 1 commit into
cli:trunkfrom
AruneshDwivedi:fix/pin-force-install
Open

fix: honor --pin when --force is specified on extension install#13602
AruneshDwivedi wants to merge 1 commit into
cli:trunkfrom
AruneshDwivedi:fix/pin-force-install

Conversation

@AruneshDwivedi
Copy link
Copy Markdown

Problem

gh extension install OWNER/REPO --pin <tag> --force ignores the pin when the extension is already installed. The --force flag routes to the upgrade path, which installs latest instead of the pinned version.

Root Cause

In command.go, when an existing extension is found and --force is set, the code calls upgradeFunc regardless of whether --pin was also provided. The upgrade path doesn't honor the pin for binary extensions.

Fix

When both --pin and --force are set, remove the existing extension first and fall through to the install path with the pin flag, ensuring the specified version is installed.

Testing

Reproduction steps from the issue now correctly install the pinned version instead of latest.

Fixes #13551

When --pin and --force are both set on an already-installed extension,
remove the existing extension first and fall through to the install path
with the pin, instead of taking the upgrade path which ignores the pin
and installs latest.

Fixes cli#13551
@AruneshDwivedi AruneshDwivedi requested a review from a team as a code owner June 6, 2026 05:24
@AruneshDwivedi AruneshDwivedi requested a review from babakks June 6, 2026 05:24
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed ready-for-review and removed needs-triage needs to be reviewed labels Jun 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

Thanks for your pull request! While it doesn't meet all of our standard requirements, it appears to be a small, focused contribution and has been routed to the team for review.

Note: We still encourage linking to an issue with the help wanted label when possible, as it helps us prioritize and track contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh extension install --pin <tag> --force ignores pin when extension is already installed

1 participant