summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-03-06 19:29:56 -0800
committerShawn O. Pearce <sop@google.com>2010-03-06 19:29:56 -0800
commit69b1e8aa65ab933fa919166d88aec90c86852beb (patch)
tree0a8635a835abfd8c05a04bd03639ab2d07e70d5f /git_config.py
parent840ed0fab7cb4c2ab296c7d7d45f13e2523bae1c (diff)
parent9452e4ec0941fbee163e35ebdcd6ca6ee7df55cb (diff)
downloadgit-repo-69b1e8aa65ab933fa919166d88aec90c86852beb.tar.gz
Merge branch 'stable'
* stable: Automatically install Gerrit Code Review's commit-msg hook Fail sync when encountering "N commits behind." Check that we are not overwriting a local repository when syncing. Honor url.insteadOf when setting up SSH control master connection sync: Fix split call on malformed email addresses Fixing project renaming bug. Conflicts: hooks/commit-msg project.py subcmds/sync.py Change-Id: I5eaf8fef8cbe4a95d124368112293a9ca64325bf
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/git_config.py b/git_config.py
index b6288219..4a42c047 100644
--- a/git_config.py
+++ b/git_config.py
@@ -461,8 +461,30 @@ class Remote(object):
461 self._Get('fetch', all=True)) 461 self._Get('fetch', all=True))
462 self._review_protocol = None 462 self._review_protocol = None
463 463
464 def _InsteadOf(self):
465 globCfg = GitConfig.ForUser()
466 urlList = globCfg.GetSubSections('url')
467 longest = ""
468 longestUrl = ""
469
470 for url in urlList:
471 key = "url." + url + ".insteadOf"
472 insteadOfList = globCfg.GetString(key, all=True)
473
474 for insteadOf in insteadOfList:
475 if self.url.startswith(insteadOf) \
476 and len(insteadOf) > len(longest):
477 longest = insteadOf
478 longestUrl = url
479
480 if len(longest) == 0:
481 return self.url
482
483 return self.url.replace(longest, longestUrl, 1)
484
464 def PreConnectFetch(self): 485 def PreConnectFetch(self):
465 return _preconnect(self.url) 486 connectionUrl = self._InsteadOf()
487 return _preconnect(connectionUrl)
466 488
467 @property 489 @property
468 def ReviewProtocol(self): 490 def ReviewProtocol(self):