Skip to content

Commit caef9f9

Browse files
authored
Fix git 2.11 error when checking IsEmpty (#27393)
Fix #27389
1 parent 624c0ba commit caef9f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/git/repo.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ func (repo *Repository) IsEmpty() (bool, error) {
8686
Stdout: &output,
8787
Stderr: &errbuf,
8888
}); err != nil {
89-
if err.Error() == "exit status 1" && errbuf.String() == "" {
89+
if (err.Error() == "exit status 1" || err.Error() == "exit status 129") && strings.TrimSpace(errbuf.String()) == "" {
90+
// git 2.11 exits with 129 if the repo is empty
9091
return true, nil
9192
}
9293
return true, fmt.Errorf("check empty: %w - %s", err, errbuf.String())

0 commit comments

Comments
 (0)