提交 b37f4b64 编写于 作者: J Jingwen Owen Ou

Fix bug that git editor having params

上级 9dcc9e57
......@@ -61,11 +61,19 @@ func (git *Git) EditorPath() (string, error) {
return "", err
}
gitEditorWithParams := strings.Split(gitEditor, " ")
gitEditor = gitEditorWithParams[0]
gitEditorParams := gitEditorWithParams[1:]
editorPath, err := exec.LookPath(gitEditor)
if err != nil {
return "", errors.New("Can't locate git editor: " + gitEditor)
}
for _, p := range gitEditorParams {
editorPath = editorPath + " " + p
}
return editorPath, nil
}
......
......@@ -19,6 +19,11 @@ func TestGitMethods(t *testing.T) {
assert.NotEqual(t, "", gitEditor)
}
gitEditorPath, err := git.EditorPath()
if err == nil {
assert.NotEqual(t, "", gitEditorPath)
}
gitRemote, _ := git.Remote()
assert.T(t, strings.Contains(gitRemote, "jingweno/gh.git"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册