tags 501982 patch
thanks

Attached patch submitted for upstream inclusion.

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
From 87fd7c67fc115158858b6fdce4ef9bf1607775f6 Mon Sep 17 00:00:00 2001
From: martin f. krafft <[EMAIL PROTECTED]>
Date: Wed, 19 Nov 2008 15:56:58 +0100
Subject: [TopGit PATCH] Check for help invocation before setup

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 <[EMAIL PROTECTED]>
---
 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

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to