Installer cannot resolve gitPath using shortened GitHub repo name if repo has a period in its name #153
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.
I'm trying to integrate the R.swift project into my Mintfile (mac-cain13/R.swift#593) and I've done so using the shorthand syntax like this:
However upon trying to install via
mint bootstrap
I get the following:After digging through the source, it looks like there is some logic in the
gitPath
computed property to detect when the user specifies a custom non-git.luolix.top hostname without a url scheme (i.emycustomdomain.com/package
) and this was done by checking for a.
in any part of the string.I'm not sure if this is the right approach since it seems a bit fragile, but I was able to work around the issue by checking that the first component of the repo string separated by
/
contains the period instead of the entire string. I've added an example and the tests verify that it hasn't caused any known regressions.I feel like there might be a nicer way to resolve this bug however I didn't want to spend too much time on it since I don't know exactly what are the valid formats. I raised this PR as a starting point but am happy to make further changes with some help 🙂
Additionally, I also noticed that in the console log the name would also be printed incorrectly:
My second commit patches this by doing
.replacingOccurrences(of: ".git", with: "")
instead ofcomponents(separatedBy: ".").first!
. I don't think there are any other intended path components so this should be ok?Thanks for all the great work on this! Let me know if I can do anything else to help with this issue 🙏