Changeset - f72ead70a22f
[Not reviewed]
default
0 2 0
domruf - 8 years ago 2017-11-29 20:17:02
dominikruf@gmail.com
Grafted from: c9b91e178a30
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.
2 files changed with 2 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/config/post_receive_tmpl.py
Show inline comments
 
@@ -19,12 +19,11 @@ def main():
 
    repo_path = os.path.abspath('.')
 
    git_stdin_lines = sys.stdin.readlines()
 
    # os.environ is modified here by a subprocess call that
 
    # 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__':
 
    main()
kallithea/config/pre_receive_tmpl.py
Show inline comments
 
@@ -19,12 +19,11 @@ def main():
 
    repo_path = os.path.abspath('.')
 
    git_stdin_lines = sys.stdin.readlines()
 
    # os.environ is modified here by a subprocess call that
 
    # 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__':
 
    main()
0 comments (0 inline, 0 general)