diff --git a/kallithea/config/post_receive_tmpl.py b/kallithea/config/post_receive_tmpl.py --- a/kallithea/config/post_receive_tmpl.py +++ b/kallithea/config/post_receive_tmpl.py @@ -4,8 +4,8 @@ import sys try: import kallithea - RC_HOOK_VER = '_TMPL_' - os.environ['RC_HOOK_VER'] = RC_HOOK_VER + KALLITHEA_HOOK_VER = '_TMPL_' + os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER from kallithea.lib.hooks import handle_git_post_receive as _handler except ImportError: if os.environ.get('RC_DEBUG_GIT_HOOK'): diff --git a/kallithea/config/pre_receive_tmpl.py b/kallithea/config/pre_receive_tmpl.py --- a/kallithea/config/pre_receive_tmpl.py +++ b/kallithea/config/pre_receive_tmpl.py @@ -4,8 +4,8 @@ import sys try: import kallithea - RC_HOOK_VER = '_TMPL_' - os.environ['RC_HOOK_VER'] = RC_HOOK_VER + KALLITHEA_HOOK_VER = '_TMPL_' + os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER from kallithea.lib.hooks import handle_git_pre_receive as _handler except ImportError: if os.environ.get('RC_DEBUG_GIT_HOOK'): diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py --- a/kallithea/model/scm.py +++ b/kallithea/model/scm.py @@ -853,7 +853,7 @@ class ScmModel(BaseModel): for h_type, tmpl in [('pre', tmpl_pre), ('post', tmpl_post)]: _hook_file = jn(loc, '%s-receive' % h_type) - _rhodecode_hook = False + has_hook = False log.debug('Installing git hook in repo %s' % repo) if os.path.exists(_hook_file): # let's take a look at this hook, maybe it's rhodecode ? @@ -861,19 +861,19 @@ class ScmModel(BaseModel): with open(_hook_file, 'rb') as f: data = f.read() matches = re.compile(r'(?:%s)\s*=\s*(.*)' - % 'RC_HOOK_VER').search(data) + % 'KALLITHEA_HOOK_VER').search(data) if matches: try: ver = matches.groups()[0] log.debug('got %s it is rhodecode' % (ver)) - _rhodecode_hook = True + has_hook = True except Exception: log.error(traceback.format_exc()) else: # there is no hook in this dir, so we want to create one - _rhodecode_hook = True + has_hook = True - if _rhodecode_hook or force_create: + if has_hook or force_create: log.debug('writing %s hook file !' % (h_type,)) try: with open(_hook_file, 'wb') as f: