chiark / gitweb /
git-branchmove: Always pass --no-verify to 'git push'
authorSean Whitton <spwhitton@spwhitton.name>
Fri, 30 Aug 2024 11:16:03 +0000 (12:16 +0100)
committerSean Whitton <spwhitton@spwhitton.name>
Thu, 26 Sep 2024 16:03:41 +0000 (17:03 +0100)
We are not doing the kind of push for which git pre-push hooks are written, so
they will often fail.  In particular, 'git branchmove' is primarily intended
for moving WIP branches around, whereas pre-push hooks are usually for the
purpose of preventing accidental pushes of unpolished work to public branches.
With this in mind, I think we should try passing --no-verify unconditionally,
instead of providing an option.

Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
scripts/git-branchmove

index 156078fa4d25a07f3897832dda05c3472c6d5afc..270d78a501a1ab7d7122a7003ee3afdf7f762f1d 100755 (executable)
@@ -187,13 +187,13 @@ foreach my $source_branch (@source_branches) {
 my @refspecs      = map { "$_->{ref}:$_->{ref}" } @source_branches;
 my @nuke_refspecs = map { ":$_->{ref}" } @source_branches;
 if ($op eq 'put') {
-    $git->push('--no-follow-tags', $remote, @refspecs);
+    $git->push(qw(--no-follow-tags --no-verify), $remote, @refspecs);
     $git->update_ref('-m', "git-branchmove: moved to $remote ($rurl)",
         '-d', $_->{ref}, $_->{hash})
       for @source_branches;
 } elsif ($op eq 'get') {
     $git->fetch('--no-tags', $remote, @refspecs);
-    $git->push('--no-follow-tags', $remote, @nuke_refspecs);
+    $git->push(qw(--no-follow-tags --no-verify), $remote, @nuke_refspecs);
 }
 
 # if the remote is a named remote, rather than just a URI, update