fix: Deal with remote urls aliased using insteadOf directives#1151
Conversation
|
@larsks, thanks for the PR resolution, I'll try to have it into this weeks release. If there is a unit test we can add maybe to |
Sure, I'll try to take a look at that this evening.
You mean here? I suspect you're correct; I wasn't sure where/how |
Oh wait, disregard. The Let me know if you need me to build the test. You are going to want to use on of our default repo fixtures. The easiest and fastest is repo_initial_commit. |
cb1d587 to
f872aff
Compare
|
I've put together a test, but it's the first test that manipulates the git configuration so there wasn't a model to follow. Let me know what you think. |
814afd3 to
174e4e3
Compare
c5b1af5 to
32cf1d8
Compare
32cf1d8 to
0bb073e
Compare
…dOf` configurations
Git permits creating URL aliases through the use of the insteadOf directive
[1]. For example, given a configuration like this:
[url "ssh://git@github.com/larsks/"]
insteadOf = me:
We can reference a remote project like this:
git clone me:myproject
Which will act as if we had actually typed:
git clone ssh://git@github.com/larsks/myproject
Previously, python-semantic-release would attempt to use the raw url from
the repository configuration (`me:myproject` in the above example), and
would fail to parse it because it's not actually a url. With this change,
psr instead calls out to `git remote get-url`, which fully expands the url
for us.
[1]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf
Closes: python-semantic-release#1150
0bb073e to
5559d23
Compare
It was a good skeleton, Thanks! Made some adjustments and expanded the tests to run across all the VCS types as they all implement |
🎉 This PR has been published as part of Version 9.17.0 🎉You can find more information about this release on the GitHub Releases page. |
Purpose
Rationale
Previously, python-semantic-release would attempt to use the raw url from
the repository configuration (
me:myprojectin the above example), andwould fail to parse it because it's not actually a url. With this change,
psr instead calls out to
git remote get-url, which fully expands any aliases via git.How I tested
Created a unit test that will modify a git configuration with a remote origin defined with an alias and the associated alias defined separately. The runtime context is loaded and then validated through the GitHub VCS client.
How to Verify