From: Ian Jackson Date: Thu, 5 Jan 2017 02:04:12 +0000 (+0000) Subject: badcommit-fixup: only detach bare X-Git-Tag: archive/debian/2.16~24^2~7 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=6f69676c5ca035f70488e4b73c07ee1113b49bb3;hp=e9908f95e2c7ada1196b1aea544dc3c451c04f7b badcommit-fixup: only detach bare --- diff --git a/badcommit-fixup b/badcommit-fixup index 1fa95d5f..b8cb88ad 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) {