Skip to content

Commit a596e12

Browse files
guyzmoankostis
authored andcommitted
remote, gitpython-developers#528: Improved way of listing URLs
+ Instead of using `git remote show` that may triggers connection to remote repo, use `git remote get-url --all` that works by only reading the `.git/config`. + Change should have no functional impact, so no test needed. + Works only with git -2.7+. Signed-off-by: Guyzmo <[email protected]>
1 parent 53c1528 commit a596e12

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: git/remote.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,9 @@ def delete_url(self, url, **kwargs):
496496
def urls(self):
497497
""":return: Iterator yielding all configured URL targets on a remote
498498
as strings"""
499-
remote_details = self.repo.git.remote("show", self.name)
499+
remote_details = self.repo.git.remote("get-url", "--all", self.name)
500500
for line in remote_details.split('\n'):
501-
if ' Push URL:' in line:
502-
yield line.split(': ')[-1]
501+
yield line
503502

504503
@property
505504
def refs(self):

0 commit comments

Comments
 (0)