# HG changeset patch # User domruf # Date 2017-11-29 20:17:02 # Node ID f72ead70a22f497f69a6c9d40f64ae46c8647caa # Parent 9bc1ee41df8c93e3ab867325aa1396e12a75064f hook: the git hooks should exit with the return value of the handlers Like with mercurial hooks, returning a non-zero value means abort the operation (if possible). So, if for example a hook returns a non-zero value to abort an unauthorized push, the git hook script needs to exit with that value. 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 @@ -22,8 +22,7 @@ def main(): # runs git and later git executes this hook. # Environ gets some additional info from kallithea system # like IP or username from basic-auth - _handler(repo_path, git_stdin_lines, os.environ) - sys.exit(0) + sys.exit(_handler(repo_path, git_stdin_lines, os.environ)) if __name__ == '__main__': 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 @@ -22,8 +22,7 @@ def main(): # runs git and later git executes this hook. # Environ gets some additional info from kallithea system # like IP or username from basic-auth - _handler(repo_path, git_stdin_lines, os.environ) - sys.exit(0) + sys.exit(_handler(repo_path, git_stdin_lines, os.environ)) if __name__ == '__main__':