haxelib icon indicating copy to clipboard operation
haxelib copied to clipboard

check for different urls when running `haxelib git`

Open ninjamuffin99 opened this issue 1 year ago • 4 comments

Currently running haxelib git it doesn't check the differences in remote urls.

Running haxelib git flixel https://github.com/HaxeFlixel/flixel.git will correctly install flixel. However, if you then try running with a different url haxelib git flixel https://github.com/FunkinCrew/flixel.git it doesn't properly update / reinstall from the new URL. Going into the cloned repo flixel/git and running git config --get remote.origin.url will show https://github.com/HaxeFlixel/flixel.git rather than the new one.

This PR runs a check from the currently installed haxelib's git remote to the newly inputted one, and if it's different, it will ask if you want to install the new one.

Right now I just have it implemented for git, not mecurial. Current implementation is agnostic to whether someone has an SSH remote url ([email protected]:HaxeFlixel/flixel) or HTTP remote url (https://github.com/HaxeFlixel/flixel)

ninjamuffin99 avatar Aug 14 '24 17:08 ninjamuffin99

how was this one looking? Should I add tests for this?

ninjamuffin99 avatar Aug 29 '24 17:08 ninjamuffin99

how was this one looking? Should I add tests for this?

Yes please, a test would be useful!

tobil4sk avatar Aug 29 '24 18:08 tobil4sk

finally got around to figuring out how to draft up a test!

I wrote it in TestInstaller.hx rather than TestGit.hx since the url checking logic was in Installer.hx.

ninjamuffin99 avatar Sep 18 '24 22:09 ninjamuffin99

how does the PR look @tobil4sk ?

ninjamuffin99 avatar Nov 22 '24 19:11 ninjamuffin99