Ignore Emacs auto-save files
[topgit/greenrd.git] / tg-depend.sh
blob43d8321a20ac2df48bdc60d87b91358512831329
1 #!/bin/sh
2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
4 # GPLv2
6 name=
9 usage()
11 echo "Usage: tg [...] depend add NAME" >&2
12 exit 1
15 ## Parse options
17 subcmd="$1"; shift || :
18 case "$subcmd" in
19 -h|"")
20 usage;;
21 add)
24 die "unknown subcommand ($subcmd)";;
25 esac
27 while [ -n "$1" ]; do
28 arg="$1"; shift
29 case "$arg" in
30 -*)
31 usage;;
33 [ -z "$name" ] || die "name already specified ($name)"
34 name="$arg";;
35 esac
36 done
39 ## Sanity checks
41 [ -n "$name" ] || die "no branch name specified"
42 branchrev="$(git rev-parse --verify "$name" 2>/dev/null)" ||
43 die "invalid branch name: $name"
45 ## Record new dependency
47 echo "$name" >>"$root_dir/.topdeps"
48 git add -f "$root_dir/.topdeps"
49 git commit -m"New TopGit dependency: $name"
50 $tg update
52 # vim:noet