mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Merge "Re-initialise repos git hooks when updating the forest"
This commit is contained in:
commit
793f90cdc0
17
project.py
17
project.py
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user