chiark / gitweb /
tg-summary.sh: Reuse already available base rev information
[topgit.git] / tg-summary.sh
index c608a18fae93d41352d65937cd5dc938846df9ae..a1f8366ba26f75a35afd59a5a3fb4fa052eb5366 100644 (file)
@@ -14,12 +14,10 @@ fi
 
 ## List branches
 
-git for-each-ref | cut -f 2 |
+git for-each-ref refs/heads | 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 ||
+               base_rev="$(git rev-parse --verify "refs/top-bases/$name" 2>/dev/null)" ||
                        continue # not a TopGit branch
 
                deps_update=' '
@@ -27,7 +25,7 @@ git for-each-ref | cut -f 2 |
                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")" != "$base_rev" ]; then
                        subject="$(git cat-file blob "$name:.topmsg" | sed -n 's/^Subject: //p')"
                else
                        # No commits yet