X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git;h=0d8b382aa9a804cd3ec54591d78d8ad9b1b8766b;hb=ff3412ee1f74cc267e6d65c03c5fd8ea2214fbe7;hp=9f511956ae1dd2dcfef3e2c16e13f6ba6f69175f;hpb=d59a6043a8a7aed97c684fb4f14fe5221df1fcaf;p=git.git diff --git a/git b/git index 9f511956..0d8b382a 100755 --- a/git +++ b/git @@ -1,19 +1,22 @@ #!/bin/sh -cmd="$1" -shift -if which git-$cmd-script >& /dev/null -then - exec git-$cmd-script "$@" -fi -if which git-$cmd >& /dev/null -then - exec git-$cmd "$@" -fi +cmd= +path=$(dirname $0) +case "$#" in +0) ;; +*) cmd="$1" + shift + test -x $path/git-$cmd-script && exec $path/git-$cmd-script "$@" + test -x $path/git-$cmd && exec $path/git-$cmd "$@" ;; +esac -alternatives=($(echo $PATH | tr ':' '\n' | while read i; do ls $i/git-*-script 2> /dev/null; done)) +echo "Usage: git COMMAND [OPTIONS] [TARGET]" +if [ -n "$cmd" ]; then + echo " git command '$cmd' not found: commands are:" +else + echo " git commands are:" +fi -echo Git command "'$cmd'" not found. Try one of -for i in "${alternatives[@]}"; do - echo $i | sed 's:^.*/git-: :' | sed 's:-script$::' -done | sort | uniq +alternatives=$(cd $path && + ls git-*-script | sed -e 's/git-//' -e 's/-script//') +echo $alternatives | fmt | sed 's/^/ /'