chiark / gitweb /
badcommit-fixup: break out $bare
[dgit.git] / badcommit-fixup
index ca2e0dfbdd28a8f02db50d38cd45244c06464d1b..44c07021f44a3fbdb947be0951345ebff4fe80b5 100755 (executable)
@@ -138,12 +138,13 @@ foreach my $rline (split /\n/, $refs) {
     push @updates, [ $refname, $obj, $rewrite ];
 }
 
+$!=0; $?=0;
+my $bare = `git rev-parse --is-bare-repository`;
+die "$? $!" if $?;
+
 open U, "|git update-ref -m 'dgit bad commit fixup' --stdin" or die $!;
 
 if ($real) {
-    $!=0; $?=0;
-    my $bare = `git rev-parse --is-bare-repository`;
-    die "$? $!" if $?;
     if ($bare eq 'false') {
        print "detaching your HEAD\n" or die $!;
        system 'git checkout --detach' and die "$! $?";