Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Make 'git' script be a bit more helpful on unrecognized commands
author
Linus Torvalds
<torvalds@ppc970.osdl.org>
Tue, 14 Jun 2005 18:01:49 +0000
(11:01 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Tue, 14 Jun 2005 18:01:49 +0000
(11:01 -0700)
git
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
96069cf
)
diff --git
a/git
b/git
index c201c60ae7522c2eb77e6463b4cd6221e588da66..9f511956ae1dd2dcfef3e2c16e13f6ba6f69175f 100755
(executable)
--- a/
git
+++ b/
git
@@
-1,4
+1,19
@@
#!/bin/sh
#!/bin/sh
-cmd="
git-$1-script
"
+cmd="
$1
"
shift
shift
-exec $cmd "$@"
+if which git-$cmd-script >& /dev/null
+then
+ exec git-$cmd-script "$@"
+fi
+
+if which git-$cmd >& /dev/null
+then
+ exec git-$cmd "$@"
+fi
+
+alternatives=($(echo $PATH | tr ':' '\n' | while read i; do ls $i/git-*-script 2> /dev/null; done))
+
+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