From 20516346c4c61b2bda16d1d27fa65aecebf9fad7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 5 Jan 2017 02:04:12 +0000 Subject: [PATCH] badcommit-fixup: only detach bare --- badcommit-fixup | 9 +++++++-- 1 file 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) { -- 2.30.2