Skip to content

Commit fc86546

Browse files
author
Linus Torvalds
committed
Make 'git' script be a bit more helpful on unrecognized commands
1 parent 96069cf commit fc86546

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

git

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
#!/bin/sh
2-
cmd="git-$1-script"
2+
cmd="$1"
33
shift
4-
exec $cmd "$@"
4+
if which git-$cmd-script >& /dev/null
5+
then
6+
exec git-$cmd-script "$@"
7+
fi
8+
9+
if which git-$cmd >& /dev/null
10+
then
11+
exec git-$cmd "$@"
12+
fi
13+
14+
alternatives=($(echo $PATH | tr ':' '\n' | while read i; do ls $i/git-*-script 2> /dev/null; done))
15+
16+
echo Git command "'$cmd'" not found. Try one of
17+
for i in "${alternatives[@]}"; do
18+
echo $i | sed 's:^.*/git-: :' | sed 's:-script$::'
19+
done | sort | uniq

0 commit comments

Comments
 (0)