summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbadcommit-fixup9
1 files changed, 7 insertions, 2 deletions
diff --git a/badcommit-fixup b/badcommit-fixup
index 1fa95d5..b8cb88a 100755
--- a/badcommit-fixup
+++ b/badcommit-fixup
@@ -132,8 +132,13 @@ foreach my $rline (split /\n/, $refs) {
open U, "|git update-ref -m 'dgit bad commit fixup' --stdin" or die $!;
if ($real) {
- print "detaching your HEAD\n" or die $!;
- system 'git checkout --detach' and die "$! $?";
+ $!=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 "$! $?";
+ }
}
for my $up (@updates) {