Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Unified Diff: git_cache.py

Issue 485663003: Non-destructive editing of git cache config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cache.py
diff --git a/git_cache.py b/git_cache.py
index 7ebe5800f796da77f12cd37077a1d27d77e5df0c..50d696242ac1ce341047e7efe40d3cc29ed48eba 100755
--- a/git_cache.py
+++ b/git_cache.py
@@ -243,14 +243,18 @@ class Mirror(object):
self.RunGit(['config', 'remote.origin.url', self.url], cwd=cwd)
self.RunGit(['config', '--replace-all', 'remote.origin.fetch',
- '+refs/heads/*:refs/heads/*'], cwd=cwd)
+ '+refs/heads/*:refs/heads/*', '\\+refs/heads/\\*:.*'], cwd=cwd)
iannucci 2014/08/19 20:58:55 let's use r"raw strings" to avoid the backslash-ma
szager1 2014/08/19 21:15:48 Done.
for ref in self.refs:
ref = ref.lstrip('+').rstrip('/')
if ref.startswith('refs/'):
refspec = '+%s:%s' % (ref, ref)
+ regex = '\\+%s:.*' % ref.replace('*', '\\*')
else:
refspec = '+refs/%s/*:refs/%s/*' % (ref, ref)
- self.RunGit(['config', '--add', 'remote.origin.fetch', refspec], cwd=cwd)
+ regex = '\\+refs/heads/%s:.*' % ref.replace('*', '\\*')
+ self.RunGit(
+ ['config', '--replace-all', 'remote.origin.fetch', refspec, regex],
+ cwd=cwd)
def bootstrap_repo(self, directory):
"""Bootstrap the repo from Google Stroage if possible.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698