Code

Customize git command for installations that lack certain commands.
authorJunio C Hamano <junkio@cox.net>
Sun, 2 Oct 2005 07:20:45 +0000 (00:20 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 2 Oct 2005 07:20:45 +0000 (00:20 -0700)
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 <junkio@cox.net>
Makefile
git.sh

index 79cafd71712425d38f8cb5974a2768b76e3a542e..4d721f2ace09f7328dd28981d8117876a4c7af15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,8 @@ PROGRAMS = \
 # Backward compatibility -- to be removed after 1.0
 PROGRAMS += git-ssh-pull git-ssh-push
 
+GIT_LIST_TWEAK =
+
 PYMODULES = \
        gitMergeCommon.py
 
@@ -131,6 +133,8 @@ endif
 
 ifdef WITH_SEND_EMAIL
        SCRIPT_PERL += git-send-email.perl
+else
+       GIT_LIST_TWEAK += -e '/^send-email$$/d'
 endif
 
 LIB_FILE=libgit.a
@@ -282,7 +286,8 @@ all:
 git: git.sh Makefile
        rm -f $@+ $@
        sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
-           -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
+           -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+           $(GIT_LIST_TWEAK) <$@.sh >$@+
        chmod +x $@+
        mv $@+ $@
 
diff --git a/git.sh b/git.sh
index 178d0f0c09cad4859656dd4480ad9c096032f545..dc383eddea5bf96a1208872299a4c2370a2f7360 100755 (executable)
--- a/git.sh
+++ b/git.sh
@@ -16,17 +16,50 @@ esac
 
 echo "Usage: git COMMAND [OPTIONS] [TARGET]"
 if [ -n "$cmd" ]; then
-    echo " git command '$cmd' not found: commands are:"
-else
-    echo " git commands are:"
+    echo "git command '$cmd' not found."
 fi
+echo "git commands are:"
 
-cat <<\EOF
-    add apply archimport bisect branch checkout cherry clone
-    commit count-objects cvsimport diff fetch format-patch
-    fsck-cache get-tar-commit-id init-db log ls-remote octopus
-    pack-objects parse-remote patch-id prune pull push rebase
-    relink rename repack request-pull reset resolve revert
-    send-email shortlog show-branch status tag verify-tag
-    whatchanged
+fmt <<\EOF | sed -e 's/^/    /'
+add
+apply
+archimport
+bisect
+branch
+checkout
+cherry
+clone
+commit
+count-objects
+cvsimport
+diff
+fetch
+format-patch
+fsck-objects
+get-tar-commit-id
+init-db
+log
+ls-remote
+octopus
+pack-objects
+parse-remote
+patch-id
+prune
+pull
+push
+rebase
+relink
+rename
+repack
+request-pull
+reset
+resolve
+revert
+send-email
+shortlog
+show-branch
+status
+tag
+verify-tag
+whatchanged
 EOF