Skip to content

Commit d7a6527

Browse files
committed
fix tests
1 parent 6647eec commit d7a6527

File tree

5 files changed

+2
-10
lines changed

5 files changed

+2
-10
lines changed

modules/git/repo.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,14 @@ func OpenRepository(repoPath string) (*Repository, error) {
109109

110110
// IsEmpty Check if repository is empty.
111111
func (repo *Repository) IsEmpty() (bool, error) {
112-
_, stderr, err := com.ExecCmdDir(repo.Path, GitExecutable, "log", "-1")
113-
if err != nil {
114-
if strings.Contains(stderr, "fatal: bad default revision 'HEAD'") {
115-
return true, nil
116-
}
117-
return false, fmt.Errorf("check empty: %v - %s", err, stderr)
118-
}
119-
120-
/*var errbuf strings.Builder
112+
var errbuf strings.Builder
121113
if err := NewCommand("log", "-1").RunInDirPipeline(repo.Path, nil, &errbuf); err != nil {
122114
if strings.Contains(errbuf.String(), "fatal: bad default revision 'HEAD'") ||
123115
strings.Contains(errbuf.String(), "fatal: your current branch 'master' does not have any commits yet") {
124116
return true, nil
125117
}
126118
return true, fmt.Errorf("check empty: %v - %s", err, errbuf.String())
127-
}*/
119+
}
128120

129121
return false, nil
130122
}

modules/git/tests/repos/repo2_empty/objects/info/.gitkeep

Whitespace-only changes.

modules/git/tests/repos/repo2_empty/objects/pack/.gitkeep

Whitespace-only changes.

modules/git/tests/repos/repo2_empty/refs/heads/.gitkeep

Whitespace-only changes.

modules/git/tests/repos/repo2_empty/refs/tags/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)