Skip to content

Commit 0842acf

Browse files
author
Junio C Hamano
committed
Customize git command for installations that lack certain commands.
When the platform lacks certain git subcommands, omit them from the list of subcommands that are available from "git" wrapper. Noticed by Geert Bosch. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 18c5a52 commit 0842acf

File tree

2 files changed

+50
-12
lines changed

2 files changed

+50
-12
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ PROGRAMS = \
122122
# Backward compatibility -- to be removed after 1.0
123123
PROGRAMS += git-ssh-pull git-ssh-push
124124

125+
GIT_LIST_TWEAK =
126+
125127
PYMODULES = \
126128
gitMergeCommon.py
127129

@@ -131,6 +133,8 @@ endif
131133

132134
ifdef WITH_SEND_EMAIL
133135
SCRIPT_PERL += git-send-email.perl
136+
else
137+
GIT_LIST_TWEAK += -e '/^send-email$$/d'
134138
endif
135139

136140
LIB_FILE=libgit.a
@@ -282,7 +286,8 @@ all:
282286
git: git.sh Makefile
283287
rm -f $@+ $@
284288
sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
285-
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
289+
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
290+
$(GIT_LIST_TWEAK) <$@.sh >$@+
286291
chmod +x $@+
287292
mv $@+ $@
288293

git.sh

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,50 @@ esac
1616

1717
echo "Usage: git COMMAND [OPTIONS] [TARGET]"
1818
if [ -n "$cmd" ]; then
19-
echo " git command '$cmd' not found: commands are:"
20-
else
21-
echo " git commands are:"
19+
echo "git command '$cmd' not found."
2220
fi
21+
echo "git commands are:"
2322

24-
cat <<\EOF
25-
add apply archimport bisect branch checkout cherry clone
26-
commit count-objects cvsimport diff fetch format-patch
27-
fsck-cache get-tar-commit-id init-db log ls-remote octopus
28-
pack-objects parse-remote patch-id prune pull push rebase
29-
relink rename repack request-pull reset resolve revert
30-
send-email shortlog show-branch status tag verify-tag
31-
whatchanged
23+
fmt <<\EOF | sed -e 's/^/ /'
24+
add
25+
apply
26+
archimport
27+
bisect
28+
branch
29+
checkout
30+
cherry
31+
clone
32+
commit
33+
count-objects
34+
cvsimport
35+
diff
36+
fetch
37+
format-patch
38+
fsck-objects
39+
get-tar-commit-id
40+
init-db
41+
log
42+
ls-remote
43+
octopus
44+
pack-objects
45+
parse-remote
46+
patch-id
47+
prune
48+
pull
49+
push
50+
rebase
51+
relink
52+
rename
53+
repack
54+
request-pull
55+
reset
56+
resolve
57+
revert
58+
send-email
59+
shortlog
60+
show-branch
61+
status
62+
tag
63+
verify-tag
64+
whatchanged
3265
EOF

0 commit comments

Comments
 (0)