Mercurial > kallithea
changeset 8072:45497a4524aa
git: clean up safety check for overwriting hooks
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 27 Dec 2019 01:58:57 +0100 |
parents | 2b7aeb9d1546 |
children | 67eeb02062fe |
files | kallithea/model/scm.py |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/scm.py Wed Dec 25 15:24:54 2019 +0100 +++ b/kallithea/model/scm.py Fri Dec 27 01:58:57 2019 +0100 @@ -734,12 +734,11 @@ log.debug('hook exists, checking if it is from kallithea') with open(_hook_file, 'rb') as f: data = f.read() - matches = re.compile(r'(?:%s)\s*=\s*(.*)' - % 'KALLITHEA_HOOK_VER').search(data) + matches = re.search(br'^KALLITHEA_HOOK_VER\s*=\s*(.*)$', data, flags=re.MULTILINE) if matches: try: ver = matches.groups()[0] - log.debug('got %s it is kallithea', ver) + log.debug('Found Kallithea hook - it has KALLITHEA_HOOK_VER %r', ver) has_hook = True except Exception: log.error(traceback.format_exc())