chiark / gitweb /
Check for cmddir earlier
[topgit.git] / tg.sh
diff --git a/tg.sh b/tg.sh
index 2961106f735402d695043f31b32ffdef298566b3..9b93f1db17990effa6025b69fc62806c0b718f3f 100644 (file)
--- a/tg.sh
+++ b/tg.sh
@@ -236,6 +236,11 @@ do_help()
 }
 
 
+## Startup
+
+[ -d "@cmddir@" ] ||
+       die "No command directory: '@cmddir@'"
+
 ## Initial setup
 
 set -e
@@ -249,9 +254,6 @@ tg="tg"
 setup_ours
 setup_hook "pre-commit"
 
-[ -d "@cmddir@" ] ||
-       die "No command directory: '@cmddir@'"
-
 ## Dispatch
 
 # We were sourced from another script for our utility functions;
@@ -270,7 +272,7 @@ shift
 case "$cmd" in
 help|--help|-h)
        do_help "$1"
-       exit 1;;
+       exit 0;;
 --hooks-path)
        # Internal command
        echo "@hooksdir@";;