Control: tags -1 patch moreinfo

Sean Whitton writes ("Bug#850547: /usr/bin/dgit-badcommit-fixup: fatal: 
multiple updates for 'refs/remotes/origin/master' are not allowed"):
>     iris ~/src/zxcvbn-c % dgit-badcommit-fixup --real
>     fatal: multiple updates for 'refs/remotes/origin/master' (including one 
> via symref 'refs/remotes/origin/HEAD') are not allowed
>     32768  at /usr/bin/dgit-badcommit-fixup line 291, <GCFO> line 214.

On irc I wrote:

16:57 <Diziet> refs/remotes/origin/HEAD is a symref ?
16:57 <Diziet> That's quite exciting.

Can you please try this patch ?  It seems to sort of work for me but I
don't have a good test case.

Thanks,
Ian.

>From 1149e5e357eaae7db70174832c82257557ce738c Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Sat, 7 Jan 2017 17:05:31 +0000
Subject: [PATCH] dgit-badcommit-fixup: Do not investigate symrefs

Signed-off-by: Ian Jackson <[email protected]>
---
 dgit-badcommit-fixup | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dgit-badcommit-fixup b/dgit-badcommit-fixup
index 0a1ebcf..a45299c 100755
--- a/dgit-badcommit-fixup
+++ b/dgit-badcommit-fixup
@@ -234,6 +234,17 @@ foreach my $rline (split /\n/, $refs) {
        next;
     }
     next if $refname =~ m{^refs/dgit-(?:badcommit|badfixuptest)/};
+
+    $!=0; $?=0;
+    system qw(sh -ec),
+       'exec >/dev/null git-symbolic-ref -q "$1"', qw(x),
+       $refname;
+    if ($?==0) {
+       $count{symrefs_ignored}++;
+       next;
+    }
+    die "$? $!" unless $?==256;
+
     my $rewrite;
     if ($type eq 'commit') {
        $rewrite = rewrite_commit($obj);
-- 
2.11.0

Reply via email to