changeset 7180:f72ead70a22f

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.
author domruf <dominikruf@gmail.com>
date Wed, 29 Nov 2017 20:17:02 +0100
parents 9bc1ee41df8c
children 07bf8445a393
files kallithea/config/post_receive_tmpl.py kallithea/config/pre_receive_tmpl.py
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/post_receive_tmpl.py	Thu Jan 25 21:49:33 2018 +0100
+++ b/kallithea/config/post_receive_tmpl.py	Wed Nov 29 20:17:02 2017 +0100
@@ -22,8 +22,7 @@
     # 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__':
--- a/kallithea/config/pre_receive_tmpl.py	Thu Jan 25 21:49:33 2018 +0100
+++ b/kallithea/config/pre_receive_tmpl.py	Wed Nov 29 20:17:02 2017 +0100
@@ -22,8 +22,7 @@
     # 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__':