Add branches support to update_plugin.sh
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', the update_plugins all fetches the most recent version from origin/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 run update_plugins all again, the catppuccin/tmux repository still had the main branch (the one that was configured with origin/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