From 4e4d40f7c07ffe4f8988ee5c225bc897bfcf2206 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 28 Oct 2013 22:28:42 -0700 Subject: [PATCH] Fix UrlInsteadOf to handle multiple strings For complex .gitconfig url rewrites, multiple insteadOf lines may be used for a url. Search all of them for the right rewrite. Change-Id: If5e9ecd054e86226924b0baf513801cd57c389cd --- git_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git_config.py b/git_config.py index 32879ec7..c1a6b55e 100644 --- a/git_config.py +++ b/git_config.py @@ -217,9 +217,9 @@ class GitConfig(object): """Resolve any url.*.insteadof references. """ for new_url in self.GetSubSections('url'): - old_url = self.GetString('url.%s.insteadof' % new_url) - if old_url is not None and url.startswith(old_url): - return new_url + url[len(old_url):] + for old_url in self.GetString('url.%s.insteadof' % new_url, True): + if old_url is not None and url.startswith(old_url): + return new_url + url[len(old_url):] return url @property