diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py --- a/kallithea/model/scm.py +++ b/kallithea/model/scm.py @@ -704,6 +704,10 @@ class ScmModel(object): log.warning('skipping overwriting hook file %s', hook_file) else: log.debug('writing hook file %s', hook_file) + if other_hook: + backup_file = hook_file + '.bak' + log.warning('moving existing hook to %s', backup_file) + os.rename(hook_file, backup_file) try: fh, fn = tempfile.mkstemp(prefix=hook_file + '.tmp.') os.write(fh, tmpl.replace(b'_TMPL_', safe_bytes(kallithea.__version__))) diff --git a/kallithea/templates/admin/settings/settings_mapping.html b/kallithea/templates/admin/settings/settings_mapping.html --- a/kallithea/templates/admin/settings/settings_mapping.html +++ b/kallithea/templates/admin/settings/settings_mapping.html @@ -25,14 +25,14 @@ ${h.form(url('admin_settings_mapping'), ${_('Install Git hooks')} - ${_("Verify if Kallithea's Git hooks are installed for each repository. Current hooks will be updated to the latest version.")} + ${_("Install Kallithea's internal hooks for all Git repositories where they are missing or can be upgraded. Existing hooks that don't seem to come from Kallithea will not be touched.")}
- ${_("If installing Git hooks, overwrite any existing hooks, even if they do not seem to come from Kallithea. WARNING: This operation will destroy any custom git hooks you may have deployed by hand!")} + ${_("Install Kallithea's internal hooks for all Git repositories. Existing hooks that don't seem to come from Kallithea will be disabled by renaming to .bak extension.")}