[TopGit PATCH] Check for help invocation before setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The user ought to be able to call `tg help` from anywhere in the
filesystem, not just Git repositories, so the help parsing has to happen
before the calls to git git binary.

Debian bug: #501982

Signed-off-by: martin f. krafft <madduck@xxxxxxxxxx>
---
 tg.sh |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tg.sh b/tg.sh
index 2961106..40c4ab7 100644
--- a/tg.sh
+++ b/tg.sh
@@ -235,6 +235,20 @@ do_help()
 	fi
 }
 
+## Startup
+
+args_saved="$@"
+while [ -n "$1" ]; do
+	case "$1" in
+	help|--help|-h)
+		shift
+		do_help "$1"
+		exit 1;;
+	esac
+	shift
+done
+set -- $args_saved
+unset args_saved
 
 ## Initial setup
 
@@ -268,9 +282,6 @@ cmd="$1"
 shift
 
 case "$cmd" in
-help|--help|-h)
-	do_help "$1"
-	exit 1;;
 --hooks-path)
 	# Internal command
 	echo "@hooksdir@";;
-- 
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux