diff options
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -986,6 +986,8 @@ class Project(object): | |||
986 | is_new = not self.Exists | 986 | is_new = not self.Exists |
987 | if is_new: | 987 | if is_new: |
988 | self._InitGitDir() | 988 | self._InitGitDir() |
989 | else: | ||
990 | self._UpdateHooks() | ||
989 | self._InitRemote() | 991 | self._InitRemote() |
990 | 992 | ||
991 | if is_new: | 993 | if is_new: |
@@ -1878,11 +1880,21 @@ class Project(object): | |||
1878 | _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), | 1880 | _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), |
1879 | os.path.join(ref_dir, 'objects') + '\n') | 1881 | os.path.join(ref_dir, 'objects') + '\n') |
1880 | 1882 | ||
1883 | self._UpdateHooks() | ||
1884 | |||
1885 | m = self.manifest.manifestProject.config | ||
1886 | for key in ['user.name', 'user.email']: | ||
1887 | if m.Has(key, include_defaults = False): | ||
1888 | self.config.SetString(key, m.GetString(key)) | ||
1881 | if self.manifest.IsMirror: | 1889 | if self.manifest.IsMirror: |
1882 | self.config.SetString('core.bare', 'true') | 1890 | self.config.SetString('core.bare', 'true') |
1883 | else: | 1891 | else: |
1884 | self.config.SetString('core.bare', None) | 1892 | self.config.SetString('core.bare', None) |
1885 | 1893 | ||
1894 | def _UpdateHooks(self): | ||
1895 | if os.path.exists(self.gitdir): | ||
1896 | # Always recreate hooks since they can have been changed | ||
1897 | # since the latest update. | ||
1886 | hooks = self._gitdir_path('hooks') | 1898 | hooks = self._gitdir_path('hooks') |
1887 | try: | 1899 | try: |
1888 | to_rm = os.listdir(hooks) | 1900 | to_rm = os.listdir(hooks) |
@@ -1892,11 +1904,6 @@ class Project(object): | |||
1892 | os.remove(os.path.join(hooks, old_hook)) | 1904 | os.remove(os.path.join(hooks, old_hook)) |
1893 | self._InitHooks() | 1905 | self._InitHooks() |
1894 | 1906 | ||
1895 | m = self.manifest.manifestProject.config | ||
1896 | for key in ['user.name', 'user.email']: | ||
1897 | if m.Has(key, include_defaults = False): | ||
1898 | self.config.SetString(key, m.GetString(key)) | ||
1899 | |||
1900 | def _InitHooks(self): | 1907 | def _InitHooks(self): |
1901 | hooks = self._gitdir_path('hooks') | 1908 | hooks = self._gitdir_path('hooks') |
1902 | if not os.path.exists(hooks): | 1909 | if not os.path.exists(hooks): |