chiark / gitweb /
tg summary: Mark current branch with '>'
authorPetr Baudis <pasky@suse.cz>
Tue, 9 Sep 2008 19:55:55 +0000 (21:55 +0200)
committerPetr Baudis <pasky@suse.cz>
Tue, 9 Sep 2008 19:55:55 +0000 (21:55 +0200)
README
tg-summary.sh

diff --git a/README b/README
index 9df3699..4d96dfb 100644 (file)
--- a/README
+++ b/README
@@ -266,7 +266,8 @@ tg remote
 tg summary
 ~~~~~~~~~~
        Show overview of all TopGit-tracked topic branches and their
-       up-to-date status ('0' marks that it introduces no own changes,
+       up-to-date status ('>' marks the current topic branch,
+       '0' marks that it introduces no own changes,
        'l'/'r' marks that it is local-only or has remote mate,
        'L'/'R' marks that it is ahead/out-of-date wrt. its remote mate,
        'D' marks that it is out-of-date wrt. its dependencies,
index 8616d07..bb71971 100644 (file)
@@ -11,6 +11,8 @@ if [ -n "$1" ]; then
        exit 1
 fi
 
+curname="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+
 
 ## List branches
 
@@ -19,6 +21,8 @@ git for-each-ref refs/top-bases |
                name="${ref#refs/top-bases/}"
                missing_deps=
 
+               current=' '
+               [ "$name" != "$curname" ] || current='>'
                nonempty=' '
                ! branch_empty "$name" || nonempty='0'
                remote=' '
@@ -45,6 +49,6 @@ git for-each-ref refs/top-bases |
                        subject="(No commits)"
                fi
 
-               printf '%s\t%-31s\t%s\n' "$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
+               printf '%s\t%-31s\t%s\n' "$current$nonempty$remote$rem_update$deps_update$deps_missing$base_update" \
                        "$name" "$subject"
        done