chiark / gitweb /
tg-delete.sh: Factor out the emptiness test to tg.sh:branch_empty()
[topgit.git] / tg.sh
diff --git a/tg.sh b/tg.sh
index 54b7875a39673886ef3abde6908922d512f0873f..56c5709f1d8f319e7d356d1b0fe9f0880cf98fed 100644 (file)
--- a/tg.sh
+++ b/tg.sh
@@ -112,6 +112,12 @@ needs_update()
        } || : # $1 is not tracked by TopGit anymore
 }
 
+# branch_empty NAME
+branch_empty()
+{
+       [ -z "$(git diff-tree "refs/top-bases/$1" "$1" | fgrep -v "     .top")" ]
+}
+
 # switch_to_base NAME [SEED]
 switch_to_base()
 {