-
Notifications
You must be signed in to change notification settings - Fork 253
Use ls-remote --get-url to get remote url #115
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a unit test in git-open/test/git-open.bats
testing this functionality (adding an insteadOf config and verifying that it expands correctly).
I'm not sure exactly why that code was added as a comment instead of patched in outright, I think @derimagia would be able to answer that? I do think this is something that should be brought up to the team. 👍 |
@4U6U57 I added a unit test; let me know if that's sufficient. |
6636bf2
to
8d130e6
Compare
Thanks for the patch! Been meaning to switch this over - I wasn't 100% on git versions it was available. We may need to figure this out in a This looks good to me 👍 |
8d130e6
to
1f03d38
Compare
As noted in a comment, 'git ls-remote --get-url' will expand insteadOf mappings. I use a number of shortcuts (like gh: for git on github, lp: for git on launchpad, me: for my github repositories, etc), so I was constantly hitting situations in which git-open would fail to do the right thing. It looks like '--get-url' has been available since git 2.12.0.
1f03d38
to
740222b
Compare
If you were really concerned about older git versions, you could do something terrible like this...
|
Instead of checking for the version number, why not check the
|
Sure, that works. |
@paulirish Ideas on how you wanted to deal with versions of git? Another option is just to fall back to the other way in an or statement. |
Actually may be a non-issue, looks like it was documented here git/git@2303cad and actually added here git/git@45781ad - that's long enough ago that I don't think we care - thought it was added more recent than that |
wow. nice digging! Yeah I just tried |
Remove package-lock.json from gitignore for npm Fix bug in paulirish#115 that modified user's gitconfig when running tests
Use ls-remote --get-url to get remote url
Remove package-lock.json from gitignore for npm Fix bug in paulirish#115 that modified user's gitconfig when running tests
As noted in a comment, 'git ls-url --get-url' will expand insteadOf
mappings. I use a number of shortcuts (like gh: for git on github,
lp: for git on launchpad, me: for my github repositories, etc), so I
was constantly hitting situations in which git-open would fail to do
the right thing.
It looks like '--get-url' has been available since git 2.12.0.
This has been bugging me for a while, but the fact that it was listed
in a comment in the script and not implemented makes me wonder if
there was in fact a reason for that.