Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Update remote URLs & support revision #91

Closed
bezhermoso opened this issue Jan 11, 2025 · 2 comments
Closed

[Feature request] Update remote URLs & support revision #91

bezhermoso opened this issue Jan 11, 2025 · 2 comments
Assignees

Comments

@bezhermoso
Copy link
Member

bezhermoso commented Jan 11, 2025

Is your feature request related to a problem? Please describe.

While in a state of working on WIP branches of template repos, I ran into issues when running tinty update:

  1. Switching between remote sources doesn't work
[[items]]
+ path = "https://github.com/tinted-theming/tinted-terminal"
- path = "https://github.com/bezhermoso/tinted-terminal"

Expected Behavior: Pulls the latest changes from tinted-theming/tinted-terminal
Actual Behavior: Stuck at bezhermoso/tinted-terminal. Either I have to go into the directory & switch the remotes, or remove it then reinstall.

  1. There is no way to target specific revisions

I use Tinty in multiple computers & I sync my Tinty config across all of them. If I'm working on a feature branch, I couldn't really express that in my configuration file:

[[items]]
path = "https://github.com/bezhermoso/tinted-terminal"
+ revision = "ghostty"

Expected Behavior: When I run tinty update on my other computers, it should pull & use that branch. I should be able to pull changes from that branch when desired. Tags & commit SHAs should also be supported.

Describe the solution you'd like

I'd like to be able to specify the exact revision I'd like to use of a template repo via a revision option for that item.

Right now, the install and update mechanism are just git clone ... and git pull. Therefore, unless you know where to the repositories are cloned on your machine & manually change the remote URL & branch there, you're pretty much stuck with whatever the remote & branch was during install. This is likely OK for 90% of scenarios but not great if you're in the middle of working on feature branches, or would like to pin to specific revisions of a repo, especially if you'd like the state you're in synced across computers.

Here's a PoC that implements these changes: https://github.com/tinted-theming/tinty/compare/main...bezhermoso:branch?body=&expand=1

Describe alternatives you've considered

For the first issue: An alternative to switching remotes via git remote set-url origin ... is deriving the destination dir to a normalized form of the git URL e.g. ~/.local/shared/tinted-theming/tinty/https--github.aaakk.us.kg--bezhermoso--tinted-theming. This way, swapping remotes just means swapping the directory used. Swapping remotes would require running tinty install.

I think this is still better than commenting in/out [[items]] entries to manage different remotes.

Additional context

NA

@JamyGolden
Copy link
Member

Thanks for looking into this and yeah it does make sense to change origin otherwise it makes it difficult to use for testing. Can you create a PR with that branch of yours and I'll review. From going through it quickly my initial comments are it should revert origin back to whatever it was if the pull fails and a test should be added to make sure this works as expected.

@bezhermoso
Copy link
Member Author

Addressed by #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants