On Fri, 2 Oct 2020 at 13:19, Joel Brobecker <brobec...@adacore.com> wrote:
>
> > > I can confirm I was able to delete a branch on remove server:
> > >
> > > $ git push origin --delete refs/users/marxin/heads/gfc-trailing-spec
> > > To git+ssh://gcc.gnu.org/git/gcc.git
> > >   - [deleted]                 refs/users/marxin/heads/gfc-trailing-spec
> >
> > That's because I fixed GCC's hook to allow branch deletion:
> > https://gcc.gnu.org/pipermail/gcc/2020-October/233914.html
>
> Interesting that you would manage this aspect yourselves.
> The git-hooks have a config option that allow to control which branch
> can be deleted (via a list of regular expressions).

Which is what Joseph said, I think. The problem was that the
update_hook script still gets called for branch deletions, and it was
rejecting them. My fix was just to stop rejecting them:

Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Oct 1 18:04:54 2020 +0000

   Do not check anything for ref deletions

diff --git a/update_hook b/update_hook
index 8b342b5..a392230 100755
--- a/update_hook
+++ b/update_hook
@@ -12,6 +12,9 @@ def main():
    ref_name = sys.argv[1]
    old_object = sys.argv[2]
    new_object = sys.argv[3]
+    if re.fullmatch('0+', new_object) is not None:
+        # This is a branch deletion.
+        sys.exit(0)
    # Do not allow updates introducing ancestry based on the old
    # git-svn repository, to ensure people rebase onto the new history
    # rather than merging branches based on git-svn history into those



Maybe the hooks.update-hook script should not be called at all for ref
deletions, if they are meant to be handled elsewhere.

Reply via email to