-if [ -n "$1" ]; then
- echo "Usage: tg [...] update" >&2
- exit 1
-fi
-
-
-name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+while [ -n "$1" ]; do
+ arg="$1"; shift
+ case "$arg" in
+ -*)
+ echo "Usage: tg [...] update [NAME]" >&2
+ exit 1;;
+ *)
+ [ -z "$name" ] || die "name already specified ($name)"
+ name="$arg";;
+ esac
+done
+
+[ -n "$name" ] || name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
die "not a TopGit-controlled branch"
base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
die "not a TopGit-controlled branch"
info "You are in a subshell. If you abort the merge,"
info "use \`exit 1\` to abort the recursive update altogether."
if ! sh -i </dev/tty; then
info "You are in a subshell. If you abort the merge,"
info "use \`exit 1\` to abort the recursive update altogether."
if ! sh -i </dev/tty; then