mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
Re-initialise repos git hooks when updating the forest
Repo now re-initialises the git-hooks reference directory when updating the forest. This allows for any new template files to be made available throughout the project forest when updating the forest. Previous functionality required the user to recreate the forest. Change-Id: I9051265028a9e77d6139791547fff095bc195077 Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
This commit is contained in:
parent
3cba0b8613
commit
a0444584cb
17
project.py
17
project.py
@ -977,6 +977,8 @@ class Project(object):
|
||||
is_new = not self.Exists
|
||||
if is_new:
|
||||
self._InitGitDir()
|
||||
else:
|
||||
self._UpdateHooks()
|
||||
self._InitRemote()
|
||||
|
||||
if is_new:
|
||||
@ -1867,11 +1869,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)
|
||||
@ -1881,11 +1893,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