diff options
author | Guyzmo <guyzmo+github@m0g.net> | 2016-10-11 14:25:23 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-11 19:18:13 +0200 |
commit | a596e1284c8a13784fd51b2832815fc2515b8d6a (patch) | |
tree | 2e0f192d539c2d920d8bf11476c3fa2ebff92e46 | |
parent | 53c15282a84e20ebe0a220ff1421ae29351a1bf3 (diff) | |
download | gitpython-a596e1284c8a13784fd51b2832815fc2515b8d6a.tar.gz |
remote, #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 <guyzmo+github@m0g.net>
-rw-r--r-- | git/remote.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/git/remote.py b/git/remote.py index 5d31a442..c28f7efb 100644 --- a/git/remote.py +++ b/git/remote.py @@ -496,10 +496,9 @@ class Remote(LazyMixin, Iterable): 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): |