chiark / gitweb /
Makefile: Use $(wildcard) for commands_in
[topgit.git] / tg-summary.sh
index c608a18..3905a8f 100644 (file)
@@ -14,25 +14,27 @@ fi
 
 ## List branches
 
-git for-each-ref | cut -f 2 |
-       while read ref; do
-               name="${ref#refs/heads/}"
-               [ "$name" != "$ref" ] ||
-                       continue # eew, not a branch
-               git rev-parse --verify "refs/top-bases/$name" >/dev/null 2>&1 ||
-                       continue # not a TopGit branch
+git for-each-ref refs/top-bases |
+       while read rev name ref; do
+               name="${ref#refs/top-bases/}"
+               missing_deps=
 
+               nonempty=' '
+               ! branch_empty "$name" || nonempty='0'
                deps_update=' '
-               [ -z "$(needs_update "$name")" ] || deps_update='D'
+               needs_update "$name" >/dev/null || deps_update='D'
+               deps_missing=' '
+               [ -z "$missing_deps" ] || deps_missing='!'
                base_update=' '
                branch_contains "$name" "refs/top-bases/$name" || base_update='B'
 
-               if [ "$(git rev-parse "$name")" != "$(git rev-parse "refs/top-bases/$name")" ]; then
+               if [ "$(git rev-parse "$name")" != "$rev" ]; then
                        subject="$(git cat-file blob "$name:.topmsg" | sed -n 's/^Subject: //p')"
                else
                        # No commits yet
                        subject="(No commits)"
                fi
 
-               printf '%s%s\t%-31s\t%s\n' "$deps_update" "$base_update" "$name" "$subject"
+               printf '%s\t%-31s\t%s\n' "$nonempty$deps_update$deps_missing$base_update" \
+                       "$name" "$subject"
        done