提交 6d5378c0 编写于 作者: M Mislav Marohnić

Merge branch 'git-worktree'

Closes #970
......@@ -37,6 +37,15 @@ func Dir() (string, error) {
}
func HasFile(segments ...string) bool {
// The blessed way to resolve paths within git dir since Git 2.5.0
output, err := gitOutput("rev-parse", "-q", "--git-path", filepath.Join(segments...))
if err == nil && output[0] != "--git-path" {
if _, err := os.Stat(output[0]); err == nil {
return true
}
}
// Fallback for older git versions
dir, err := Dir()
if err != nil {
return false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册