-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Fix] install.sh: Force remote name of cloned repo to be 'origin' #3654
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
base: master
Are you sure you want to change the base?
Conversation
This is a duplicate of #3341, and can't land as-is for the same reason. |
It'd be great to add tests, perhaps inside https://github.com/nvm-sh/nvm/blob/2b5e53fcd57409e018b468fd05eebad06fbff3fa/test/install_script/install_nvm_from_git |
The script assumes that the name of the remote is `origin`, but this is not the case if the user has set `clone.defaultRemoteName` to another value in the ~/.gitconfig (or elsewhere in the configuration). Adding `-o origin` ensures that the remote will be called `origin` regardless of the `clone.defaultRemoteName` setting. Per PR nvm-sh#3341: - The minimum Git version this should work with is v1.7.10. (This is not documented in the repo itself; it's just an implicit requirement.) - The `--origin` option was added to `git clone` in commit 98a4fef3f2 which was released in v1.2.5. From the diff of that commit, the `-o` option was already available at that time. So this easily satisfies the above. - A comment in nvm-sh#3341 indicates that `-o` was added in v1.1.0. I've not verified this, but we probably don't need to track that down since by the above we're already well within requirements.
2b6c9aa
to
7c82abd
Compare
It would. I've just updated the commit message to bring in the version information from #3341 so that doesn't get lost in the depths of GitHub tickets. I'll should be able to look at the testing situation later today, or over the weekend at the latest. Depending on the difficulty, I may suggest it's better just to get the change in without waiting for proper automated tests if those will be difficult, since this change on the face of it can't break anything that's not already broken unless someone's using a truly ancient version of Git, but it's worth delaying slightly until we actually know what's involved with such a test. And there's also the issue of all the failing PR checks at least some of which seem clearly unrelated to this change; I have no idea what to do about that. But I think we at least want some idea of why they're happening before we e.g. decide to ignore them or whatever. |
The WSL changes are known; and the v0.40.0 failures are expected, so indeed it’s nothing you need to worry about. |
Ok, I've started looking at adding a test for this, and I've run into a few issues. Some of these are no doubt due to me being unfamiliar with the code, but I'm documenting them here for posterity in case you want to consider mitigating any of them.
So am I correct that this script is intended to be run as follows?
I'll look through the script and give you further notes in the next comment. |
Here are a few thoughts on the
My notes:
Overall there's a fair amount of work to be done here, and it probably won't be quick work even for those who know what they're doing given that the script takes 45 seconds for every run. I don't feel particularly comfortable hacking on this by myself since even after all I've learned in the last few hours of work I still keep discovering things I don't know. My suggestion is that we simply merge this fix, and if we want to improve the testing of this, make it a separate project. I've got tons of experience doing testing like this and would be happy to remote pair-program with someone (using voice chat and tmate) if someone who knows more about the overall testing system wants to put in the time and effort. |
So what are we currently waiting on in order to get this fix merged? |
See the commit message(s) for details. (I avoid duplicating them here because the commit messages are being updated as we review.)
Feel free to change the commit message (or anything else) as necessary. The
[Fix]
prefix is not mentioned in the "rest of the conventions" for commit messages, but seems to be what is used for similar things in previous commits.This has been tested manually on my personal machine, where I use
clone.defaultRemoteName
. The automated tests against the current head ofmaster
(make TEST_SUITE=fast test-bash
) had some issues for me, including what looked like spurious failures; I assume that this is just my configuration.The CI tests below also appear to have unrelated issues, giving e.g.
sed: /etc/apt/sources.list: No such file or directory
on WSL.