##// END OF EJS Templates
hooks: handle delete branch permission case with branch protection
dan -
r643:d42f7af5 default
parent child Browse files
Show More
@@ -511,15 +511,14 b' def git_pre_receive(unused_repo_path, re'
511
511
512 type_ = push_ref['type']
512 type_ = push_ref['type']
513 new_branch = push_ref['old_rev'] == empty_commit_id
513 new_branch = push_ref['old_rev'] == empty_commit_id
514 if type_ == 'heads' and not new_branch:
514 delete_branch = push_ref['new_rev'] == empty_commit_id
515 if type_ == 'heads' and not (new_branch or delete_branch):
515 old_rev = push_ref['old_rev']
516 old_rev = push_ref['old_rev']
516 new_rev = push_ref['new_rev']
517 new_rev = push_ref['new_rev']
517 cmd = [settings.GIT_EXECUTABLE, 'rev-list',
518 cmd = [settings.GIT_EXECUTABLE, 'rev-list', old_rev, '^{}'.format(new_rev)]
518 old_rev, '^{}'.format(new_rev)]
519 stdout, stderr = subprocessio.run_command(
519 stdout, stderr = subprocessio.run_command(
520 cmd, env=os.environ.copy())
520 cmd, env=os.environ.copy())
521 # means we're having some non-reachable objects, this forced push
521 # means we're having some non-reachable objects, this forced push was used
522 # was used
523 if stdout:
522 if stdout:
524 push_ref['pruned_sha'] = stdout.splitlines()
523 push_ref['pruned_sha'] = stdout.splitlines()
525
524
General Comments 0
You need to be logged in to leave comments. Login now