提交 1642c5e2 编写于 作者: J John Whitley 提交者: Mislav Marohnić

don't show help page when --exec-path or --html-path are requested

hub would erroneously display the help page instead of forwarding the
arguments to git.

Bonus: make test/fakebin/git POSIX shell compatible; was using bashisms.
上级 5b49ad0e
......@@ -11,7 +11,7 @@ module Hub
@args = Args.new(args)
# Hack to emulate git-style
@args.unshift 'help' if @args.grep(/^[^-]|version/).empty?
@args.unshift 'help' if @args.grep(/^[^-]|version|exec-path$|html-path/).empty?
# git commands can have dashes
cmd = @args[0].sub(/(\w)-/, '\1_')
......
#!/bin/sh
if [[ $1 == "--version" ]]; then
if [ "$1" = "--version" ]; then
echo "git version 1.7.0.4"
elif [ "$1" = "--exec-path" ]; then
echo "/usr/lib/git-core"
elif [ "$1" = "--html-path" ]; then
echo "/usr/share/doc/git-doc"
else
echo "ERROR: git was called, but wasn't supposed to:" git $*
exit 1
......
......@@ -491,6 +491,21 @@ class HubTest < Test::Unit::TestCase
assert_includes "hub version #{Hub::Version}", out
end
def test_exec_path
out = hub('--exec-path')
assert_equal "/usr/lib/git-core\n", out
end
def test_exec_path_arg
out = hub('--exec-path=/home/wombat/share/my-l33t-git-core')
assert_equal Hub::Commands.improved_help_text, hub("")
end
def test_html_path
out = hub('--html-path')
assert_equal "/usr/share/doc/git-doc\n", out
end
def test_help
assert_equal Hub::Commands.improved_help_text, hub("help")
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册