Merge "Re-initialise repos git hooks when updating the forest"

This commit is contained in:
David Pursehouse 2013-05-09 08:36:11 +00:00 committed by Gerrit Code Review
commit 793f90cdc0

View File

@ -986,6 +986,8 @@ class Project(object):
is_new = not self.Exists
if is_new:
self._InitGitDir()
else:
self._UpdateHooks()
self._InitRemote()
if is_new:
@ -1878,11 +1880,21 @@ class Project(object):
_lwrite(os.path.join(self.gitdir, 'objects/info/alternates'),
os.path.join(ref_dir, 'objects') + '\n')
self._UpdateHooks()
m = self.manifest.manifestProject.config
for key in ['user.name', 'user.email']:
if m.Has(key, include_defaults = False):
self.config.SetString(key, m.GetString(key))
if self.manifest.IsMirror:
self.config.SetString('core.bare', 'true')
else:
self.config.SetString('core.bare', None)
def _UpdateHooks(self):
if os.path.exists(self.gitdir):
# Always recreate hooks since they can have been changed
# since the latest update.
hooks = self._gitdir_path('hooks')
try:
to_rm = os.listdir(hooks)
@ -1892,11 +1904,6 @@ class Project(object):
os.remove(os.path.join(hooks, old_hook))
self._InitHooks()
m = self.manifest.manifestProject.config
for key in ['user.name', 'user.email']:
if m.Has(key, include_defaults = False):
self.config.SetString(key, m.GetString(key))
def _InitHooks(self):
hooks = self._gitdir_path('hooks')
if not os.path.exists(hooks):