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

check for different urls when running haxelib git #640

Open
wants to merge 11 commits into
base: development
Choose a base branch
from

Conversation

ninjamuffin99
Copy link
Contributor

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 (git@github.com:HaxeFlixel/flixel) or HTTP remote url (https://github.com/HaxeFlixel/flixel)

@skial skial mentioned this pull request Aug 21, 2024
1 task
@ninjamuffin99
Copy link
Contributor Author

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

@tobil4sk
Copy link
Member

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

Yes please, a test would be useful!

ninjamuffin99 and others added 6 commits August 29, 2024 15:33
It only has to be checked when running interp scripts, so we can avoid
checking it in other cases.
…ion#638)

* submodule stuff in progress

* perhaps a submodule fix?

* revert the dipshit logging

* update run.n

* we dont need to spit out every log, but we should use the threads?

* comment out the unneeded git fetch

* small reorder / remove redundant `git submodule init`

* uncomment the lib deletion, since we've ran into issues related

* fix for stderr/stdout related hangs on non-windows when installing git submodules

* remove git progress code

* run.n

* remove whitespace

* proper non-cli coupled logging

* remove unneeded logging/git --quiet flag code for the time being

* run.n

* remove unneeded FsUtils.deleteRec()

* run.n

* remove testing print

* run.n

* removed unused import and throw an exception on submodule error

* add message for SubmoduleError
…cal or not

testing in progress

accident git thingie
@ninjamuffin99
Copy link
Contributor Author

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
Copy link
Contributor Author

how does the PR look @tobil4sk ?

@@ -0,0 +1 @@
-lib flixel:git:https://github.com/geokureli/flixel.git#4.5.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to set up a url that is just a path to a local directory. There is a util function for setting up a git repository, and there is a test/libraries folder with some existing libraries that could be pointed to.

function makeGitRepo(libPath:String) {

final vcsLibPath = "libraries/libBar";
final vcsLibNoHaxelibJson = "libraries/libNoHaxelibJson";
final vcsBrokenDependency = "libraries/libBrokenDep";

External repositories may change ownership or move (and they rely on the network to clone), so it is more reliable to clone from local repositories in tests, especially the unit tests.

@@ -105,6 +106,19 @@ class TestInstaller extends TestBase {
assertTrue(scope.isLibraryInstalled(ProjectName.ofString("hx.signal")));
}

public function testInstallUrlChanges() {
installer.installFromHxml("git-deps-url-old.hxml");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this test, we should run installVcsLibrary rather than installFromHxml, since we are only testing the git functionality

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

Successfully merging this pull request may close these issues.

2 participants