summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-05 02:04:12 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-05 02:04:12 +0000
commit6f69676c5ca035f70488e4b73c07ee1113b49bb3 (patch)
tree1314d159eeba94fbb3b74e0a69a09ae56da83810
parente9908f95e2c7ada1196b1aea544dc3c451c04f7b (diff)
badcommit-fixup: only detach bare
-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) {