Skip to content

Commit b3f5c99

Browse files
committed
fix tests
1 parent 25ee433 commit b3f5c99

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

modules/git/repo.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,12 @@ func OpenRepository(repoPath string) (*Repository, error) {
109109

110110
// IsEmpty Check if repository is empty.
111111
func (repo *Repository) IsEmpty() (bool, error) {
112-
output, err := NewCommand("log", "-1").RunInDir(repo.Path)
112+
_, stderr, err := com.ExecCmdDir(repo.Path, GitExecutable, "log", "-1")
113113
if err != nil {
114-
if strings.Contains(err.Error(), "fatal: bad default revision 'HEAD'") ||
115-
strings.Contains(err.Error(), "fatal: your current branch 'master' does not have any commits yet") {
114+
if strings.Contains(stderr, "fatal: bad default revision 'HEAD'") {
116115
return true, nil
117116
}
118-
return true, fmt.Errorf("check empty: %v - %s", err, output)
117+
return true, fmt.Errorf("check empty: %v - %s", err, stderr)
119118
}
120119
return false, nil
121120
}

0 commit comments

Comments
 (0)