Repository navigation
Reselect assets only when --filter changes - #21
Merged
Merged
Conversation
cmd.Flags().Changed reports that --filter was passed, not that it differs from the saved filter. Repeating the same install command therefore selected assets again and reinstalled the package at the installed version, replacing the remembered selection. Compare --filter with the saved filter instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Owner
|
thanks! |
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.
Problem
The README says "Changing
--filterstarts asset selection again", butinstallusescmd.Flags().Changed("filter"), which only reports that-fwas passed. Running the same command twice, for examplegrm install --yes -f tar.gz bootandy/dust, reinstalls the package the second time even though it is already at the latest release.Scripts and Ansible tasks repeat the same install command, so every run downloads and reinstalls every package that was given
-f. The repeated filter also discards the remembered selection. For example, if only some binaries in an archive were selected,--yesinstalls all of them again, and without--yesgrm asks again whenever there are several suitable assets or binaries. For a package installed before v2,reselectalso disables the legacy migration that keeps the installed binary.Change
installcompares--filterwith the saved filter. A different filter selects assets again as before. Passing the saved filter keeps the remembered selection, so the "already at" check applies, and an update reuses the saved asset and binaries. README and AGENTS.md describe this.Tested
New
TestInstallReselectsOnlyWhenFilterChangesrunsinstallCmdfor a tracked package with a saved filter and a saved selection of one of the archive's two binaries:The first two cases fail on
master.make fmt vet build lintpasses.go test ./...passes in afedora:44container as root and as a regular user, and the new test passes with-race. On Ubuntu, three existing asset filter tests fail onmastertoo, because they expectrpmto be installed anddpkgto be missing.E2E in
fedora:44: runninggrm install --yes -f tar.gz bootandy/dusttwice printsbootandy/dust already at v1.2.6the second time, wherev2.0.8reinstalls. A followinggrm install --yes -f musl bootandy/dustinstalls the musl asset on both.This change is independent of #20.