chiark / gitweb /
tg delete: Allow branch delete if we aren't on symbolic HEAD
authorPetr Baudis <pasky@suse.cz>
Fri, 12 Sep 2008 15:56:45 +0000 (17:56 +0200)
committerPetr Baudis <pasky@suse.cz>
Fri, 12 Sep 2008 15:56:45 +0000 (17:56 +0200)
tg-delete.sh

index 075d15c..26e2741 100644 (file)
@@ -31,7 +31,7 @@ branchrev="$(git rev-parse --verify "$name" 2>/dev/null)" ||
        die "invalid branch name: $name"
 baserev="$(git rev-parse --verify "refs/top-bases/$name" 2>/dev/null)" ||
        die "not a TopGit topic branch: $name"
-[ "$(git symbolic-ref HEAD)" != "refs/heads/$name" ] ||
+! git symbolic-ref HEAD || [ "$(git symbolic-ref HEAD)" != "refs/heads/$name" ] ||
        die "cannot delete your current branch"
 
 nonempty=