X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=tg-update.sh;h=b256c7c270b41c4e8f5d384a7ece4011d07beb74;hp=f36624fe71b73263471e5df8fbb0014d47ca2ee0;hb=ff59ac7fce3326e0b0163a780ecb49dd3b1de8d1;hpb=d5cc14199b3186453a1819a3ac3a31725cda66f9 diff --git a/tg-update.sh b/tg-update.sh index f36624f..b256c7c 100644 --- a/tg-update.sh +++ b/tg-update.sh @@ -8,13 +8,19 @@ name= ## Parse options -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" @@ -59,7 +65,7 @@ if [ -s "$depcheck" ]; 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