diff options
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 17 |
1 files changed, 12 insertions, 5 deletions
| @@ -977,6 +977,8 @@ class Project(object): | |||
| 977 | is_new = not self.Exists | 977 | is_new = not self.Exists |
| 978 | if is_new: | 978 | if is_new: |
| 979 | self._InitGitDir() | 979 | self._InitGitDir() |
| 980 | else: | ||
| 981 | self._UpdateHooks() | ||
| 980 | self._InitRemote() | 982 | self._InitRemote() |
| 981 | 983 | ||
| 982 | if is_new: | 984 | if is_new: |
| @@ -1867,11 +1869,21 @@ class Project(object): | |||
| 1867 | _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), | 1869 | _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), |
| 1868 | os.path.join(ref_dir, 'objects') + '\n') | 1870 | os.path.join(ref_dir, 'objects') + '\n') |
| 1869 | 1871 | ||
| 1872 | self._UpdateHooks() | ||
| 1873 | |||
| 1874 | m = self.manifest.manifestProject.config | ||
| 1875 | for key in ['user.name', 'user.email']: | ||
| 1876 | if m.Has(key, include_defaults = False): | ||
| 1877 | self.config.SetString(key, m.GetString(key)) | ||
| 1870 | if self.manifest.IsMirror: | 1878 | if self.manifest.IsMirror: |
| 1871 | self.config.SetString('core.bare', 'true') | 1879 | self.config.SetString('core.bare', 'true') |
| 1872 | else: | 1880 | else: |
| 1873 | self.config.SetString('core.bare', None) | 1881 | self.config.SetString('core.bare', None) |
| 1874 | 1882 | ||
| 1883 | def _UpdateHooks(self): | ||
| 1884 | if os.path.exists(self.gitdir): | ||
| 1885 | # Always recreate hooks since they can have been changed | ||
| 1886 | # since the latest update. | ||
| 1875 | hooks = self._gitdir_path('hooks') | 1887 | hooks = self._gitdir_path('hooks') |
| 1876 | try: | 1888 | try: |
| 1877 | to_rm = os.listdir(hooks) | 1889 | to_rm = os.listdir(hooks) |
| @@ -1881,11 +1893,6 @@ class Project(object): | |||
| 1881 | os.remove(os.path.join(hooks, old_hook)) | 1893 | os.remove(os.path.join(hooks, old_hook)) |
| 1882 | self._InitHooks() | 1894 | self._InitHooks() |
| 1883 | 1895 | ||
| 1884 | m = self.manifest.manifestProject.config | ||
| 1885 | for key in ['user.name', 'user.email']: | ||
| 1886 | if m.Has(key, include_defaults = False): | ||
| 1887 | self.config.SetString(key, m.GetString(key)) | ||
| 1888 | |||
| 1889 | def _InitHooks(self): | 1896 | def _InitHooks(self): |
| 1890 | hooks = self._gitdir_path('hooks') | 1897 | hooks = self._gitdir_path('hooks') |
| 1891 | if not os.path.exists(hooks): | 1898 | if not os.path.exists(hooks): |
