summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-01-07 12:23:34 +0000
committerSean Whitton <spwhitton@spwhitton.name>2020-01-07 12:23:34 +0000
commite170bc9421e95936becf926a53c9cbb255ad85c6 (patch)
tree077713288548452dc4aa6ead0c10d33b9ec491fd
parent0eca21b1f48a0a95693993d43021c8b4a79140c0 (diff)
downloaddotfiles-e170bc9421e95936becf926a53c9cbb255ad85c6.tar.gz
annex-to-annex: abort if detect any detached HEADs
-rwxr-xr-xbin/annex-to-annex6
1 files changed, 6 insertions, 0 deletions
diff --git a/bin/annex-to-annex b/bin/annex-to-annex
index 3d412ee4..3db6273d 100755
--- a/bin/annex-to-annex
+++ b/bin/annex-to-annex
@@ -47,6 +47,9 @@ if ($ARGV[0] eq '--commit') {
my @git_status = `git -C "$dest" status --porcelain`;
die "git repo containing $dest is not clean; please commit\n"
unless @git_status == 0;
+
+ `git -C "$dest" symbolic-ref --quiet HEAD`;
+ die "$dest has a detached HEAD; aborting" unless $? == 0;
}
my @sources = map rel2abs($_), @ARGV;
@@ -64,6 +67,9 @@ foreach my $source (@sources) {
my @git_status = `git -C "$dir" status --porcelain`;
die "git repo containing $source is not clean; please commit\n"
unless @git_status == 0;
+
+ `git -C "$dir" symbolic-ref --quiet HEAD`;
+ die "$dir has a detached HEAD; aborting" unless $? == 0;
}
my $base = basename($source);