chiark / gitweb /
tg info: Carry over missing Subject line in topmsg
[topgit.git] / tg-info.sh
index f5502db9ac507a8a2db841ba2818429eb8aa5fff..17eca60853d6553af370202a6d9095336e1a7580 100644 (file)
@@ -12,7 +12,7 @@ while [ -n "$1" ]; do
        arg="$1"; shift
        case "$arg" in
        -*)
-               echo "Usage: tg info [NAME]" >&2
+               echo "Usage: tg [...] info [NAME]" >&2
                exit 1;;
        *)
                [ -z "$name" ] || die "name already specified ($name)"
@@ -32,11 +32,11 @@ if [ "$(git rev-parse --short "$name")" = "$base_rev" ]; then
        exit 0
 fi
 
-git cat-file blob "$name:.topmsg" | grep ^Subject:
+git cat-file blob "$name:.topmsg" | grep ^Subject: || :
 
 echo "Base: $base_rev"
 branch_contains "$name" "$base_rev" ||
-       echo "* Base is newer than head! Please run \`tg update\`."
+       echo "* Base is newer than head! Please run \`$tg update\`."
 
 if has_remote "$name"; then
        echo "Remote Mate: $base_remote/$name"
@@ -44,6 +44,8 @@ if has_remote "$name"; then
                echo "* Local base is out of date wrt. the remote base."
        branch_contains "$name" "refs/remotes/$base_remote/$name" ||
                echo "* Local head is out of date wrt. the remote head."
+       branch_contains "refs/remotes/$base_remote/$name" "$name" ||
+               echo "* Local head is ahead of the remote head."
 fi
 
 git cat-file blob "$name:.topdeps" |