X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=tg-depend.sh;h=e1a6f17f279aa0b4ae8e6ba8030bd513d18e6a55;hp=af78808805449428ca0db06a2c5076ae116ac6a2;hb=b725fc951a37854fc65945ac5bcab3bc61ccbd94;hpb=d272e32afc116764cf2afc1033320953466f5ed5 diff --git a/tg-depend.sh b/tg-depend.sh index af78808..e1a6f17 100644 --- a/tg-depend.sh +++ b/tg-depend.sh @@ -8,8 +8,16 @@ name= ## Parse options -subcmd="$1"; shift -[ "$subcmd" = "add" ] || die "unknown subcommand ($subcmd)" +subcmd="$1"; shift || : +case "$subcmd" in + -h|"") + echo "Usage: tg [...] depend add NAME" >&2 + exit 1;; + add) + ;; + *) + die "unknown subcommand ($subcmd)";; +esac while [ -n "$1" ]; do arg="$1"; shift @@ -29,13 +37,12 @@ done [ -n "$name" ] || die "no branch name specified" branchrev="$(git rev-parse --verify "$name" 2>/dev/null)" || die "invalid branch name: $name" -baserev="$(git rev-parse --verify "refs/top-bases/$name" 2>/dev/null)" || - die "not a TopGit topic branch: $name" - ## Record new dependency -echo "$name" >>.topdeps -git add .topdeps +echo "$name" >>"$root_dir/.topdeps" +git add -f "$root_dir/.topdeps" git commit -m"New TopGit dependency: $name" $tg update + +# vim:noet