提交 4412eddf 编写于 作者: M Mislav Marohnić

Fix compatibility with git when run with no arguments

Fixes this error:

    $ hub --git-dir=.git
    git: '' is not a git command. See 'git --help'.

Instead, help text is shown just like with normal git.
上级 a742c67a
......@@ -65,7 +65,10 @@ func (r *Runner) Execute(cliArgs []string) error {
return err
}
gitArgs := []string{args.Command}
gitArgs := []string{}
if args.Command != "" {
gitArgs = append(gitArgs, args.Command)
}
gitArgs = append(gitArgs, args.Params...)
return git.Run(gitArgs...)
......
......@@ -31,3 +31,8 @@ Feature: git-hub compatibility
Scenario: Doesn't sabotage --exec-path
When I successfully run `hub --exec-path`
Then the output should not contain "These GitHub commands"
Scenario: Shows help with --git-dir
When I run `hub --git-dir=.git`
Then the exit status should be 1
And the output should contain "usage: git "
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册