Skip to content

git.remote.Remote.set_url does not add new URL by default #1447

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

Open
deroshkin opened this issue May 25, 2022 · 2 comments
Open

git.remote.Remote.set_url does not add new URL by default #1447

deroshkin opened this issue May 25, 2022 · 2 comments

Comments

@deroshkin
Copy link

The documentation for Remote.set_url states that new_url is "add[ed] as an extra remote URL" unless old_url parameter is passed. However, the way it is currently written, the method actually replaces the existing URL instead of adding a new one.

repo = git.Repo.init('.')
remote = repo.create_remote('name', 'url')
remote.set_url('newurl')
for url in repo.remote('name').urls::
    print(url)

actual output:

newurl

expected:

url
newurl
@deroshkin
Copy link
Author

I have a patch ready, but I'll hold off submitting a pull request since the current TestRemote.test_multiple_urls in test_remote.py actually depends on the current behavior, so I'm not sure whether to change the set_url docstring or the behavior.

@Byron
Copy link
Member

Byron commented May 26, 2022

Here I recommend improving the documentation to clarify what it does while considering the addition of another method to exhibit the new behaviour of actually adding another URL on top of the existing one as multi-value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants