Add branches support to update_plugin.sh #299
Open
+43
−6
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.
Encountered problem
Recently I've encountered an issue with https://github.com/catppuccin/tmux/tree/main plugin. The most recent release was not backwards compatible (major version update), and because of that my config was no longer working, although I was happy with how it had looked like.
The catppuccin plugin was added to my tmux.conf like this:
set-option -g @plugin 'catppuccin/tmux'
Since there was no tag specified like
'catppuccin/tmux#v0.3'
, theupdate_plugins all
fetches the most recent version fromorigin/HEAD
-- which is to be expected. What I hadn't expected, was that when I had fixed my config by adding the tag:set-option -g @plugin 'catppuccin/tmux#v0.3'
restarted
tmux
, and runupdate_plugins all
again, thecatppuccin/tmux
repository still had themain
branch (the one that was configured withorigin/HEAD
) checked out. Only when I had removed the plugin entirely and then brought it back with the appropriate version, the problem was solved.When user changes the version in the config it is not used by the
update_plugins
. It means that in order to change the version, the user has to remove the plugin entirely and then reinstall it.Cause
The issue was that scripts/update_plugin.sh ignores branches/tags/commits set in the config.
Fix
I have fixed the described issue in this PR. Could you please kindly take a look? Any suggestions and comments are highly appreciated.
I haven't contributed to the
tpm
project yet, so I understand that the changes that I've made might not follow the used coding style (although, I did my best to make sure they do). In case you find the code style to be incompatible, please kindly let me know.Git version
The fix was tested with the following
git
versions:2.43.0
2.47.0