test-lib-functions.sh: use '%s\n' instead of "%s\n"
[topgit/pro.git] / tg-base.sh
blob8b2e9e943c7e98779d68dbcfbce3f87835567a2e
1 #!/bin/sh
2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
4 # (c) Per Cederqvist <ceder@lysator.liu.se> 2010
5 # GPLv2
7 ## Parse options
9 case "$1" in
10 -h|--help)
11 echo "Usage: ${tgname:-tg} [...] base [ branch... ]" >&2
12 exit 0;;
14 break;;
15 esac
17 if [ "$#" -eq 0 ]; then
18 set -- HEAD
21 rv=0
22 for rev in "$@"; do
23 name="$(strip_ref "$(git symbolic-ref -q "$rev" 2>/dev/null || echol "$rev")")"
24 git rev-parse --short --verify "refs/$topbases/$name" -- 2>/dev/null || {
25 rv=1
26 echo "$rev is not a TopGit branch" >&2
28 done
29 exit $rv