Skip to content

Improved way of listing URLs in remote #528

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

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improved way of listing URLs in remote
instead of using git remote show that can trigger a connection to the
remote repository, use git remote get-url --all that works by only
reading the .git/config.

change should have no functional impact, so no test needed.

Signed-off-by: Guyzmo <guyzmo+github@m0g.net>
  • Loading branch information
guyzmo committed Oct 11, 2016
commit 7642479871b5f40ee02e3d481bfe111cd68457e1
5 changes: 2 additions & 3 deletions git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,9 @@ def delete_url(self, url, **kwargs):
def urls(self):
""":return: Iterator yielding all configured URL targets on a remote
as strings"""
remote_details = self.repo.git.remote("show", self.name)
remote_details = self.repo.git.remote("get-url", "--all", self.name)
for line in remote_details.split('\n'):
if ' Push URL:' in line:
yield line.split(': ')[-1]
yield line

@property
def refs(self):
Expand Down