These flags override the GIT_DIR and EDITOR environment variables. --- This is more generic way to specify GIT_DIR than Linus' suggestion, although it is only targeted at more porcelainish usage of the git driver script. I needed this for the Emacs commands I've been hacking on, since it's hard to set environment variables for single commands without involving /bin/env or a shell. git.sh | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-) b9a38ed5a16289f86b353c0bb541e607d35180a9 diff --git a/git.sh b/git.sh --- a/git.sh +++ b/git.sh @@ -2,19 +2,32 @@ cmd= path=$(dirname $0) -case "$#" in -0) ;; -*) cmd="$1" - shift - case "$cmd" in - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "git version @@GIT_VERSION@@" - exit 0 ;; - esac - test -x $path/git-$cmd && exec $path/git-$cmd "$@" ;; -esac -echo "Usage: git COMMAND [OPTIONS] [TARGET]" +while test "$#" -gt 0 +do + case "$1" in + -d) export GIT_DIR + GIT_DIR=$2 + shift + ;; + -e) export EDITOR + EDITOR=$2 + shift + ;; + *) cmd="$1" + shift + case "$cmd" in + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "git version @@GIT_VERSION@@" + exit 0 ;; + esac + test -x $path/git-$cmd && exec $path/git-$cmd "$@" + ;; + esac + shift +done + +echo "Usage: git [GLOBAL OPTIONS] COMMAND [COMMAND OPTIONS]" if [ -n "$cmd" ]; then echo " git command '$cmd' not found: commands are:" else -- David Kågedal - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Mon Sep 19 20:24:04 2005
This archive was generated by hypermail 2.1.8 : 2005-09-19 20:24:07 EST