sep="|"
done
- echo "TopGit v0.4 - A different patch queue manager"
+ echo "TopGit v0.5 - A different patch queue manager"
echo "Usage: tg [-r REMOTE] ($cmds|help) ..."
elif [ -r "@cmddir@"/tg-$1 ] ; then
@cmddir@/tg-$1 -h || :
}
+## Startup
+
+[ -d "@cmddir@" ] ||
+ die "No command directory: '@cmddir@'"
+
+args_saved="$@"
+while [ -n "$1" ]; do
+ case "$1" in
+ help|--help|-h)
+ shift
+ do_help "$1"
+ exit 0;;
+ esac
+ shift
+done
+set -- $args_saved
+unset args_saved
+
## Initial setup
set -e
git_dir="$(git rev-parse --git-dir)"
root_dir="$(git rev-parse --show-cdup)"; root_dir="${root_dir:-.}"
+# Make sure root_dir doesn't end with a trailing slash.
+root_dir="${root_dir%/}"
base_remote="$(git config topgit.remote 2>/dev/null)" || :
tg="tg"
# make sure merging the .top* files will always behave sanely
setup_ours
setup_hook "pre-commit"
-[ -d "@cmddir@" ] ||
- die "No command directory: '@cmddir@'"
-
## Dispatch
# We were sourced from another script for our utility functions;
fi
cmd="$1"
-[ -n "$cmd" ] || die "He took a duck in the face at two hundred and fifty knots"
+[ -n "$cmd" ] || { do_help; exit 1; }
shift
case "$cmd" in
-help|--help|-h)
- do_help "$1"
- exit 1;;
--hooks-path)
# Internal command
echo "@hooksdir@";;