Skip to content

Commit

Permalink
Fix git 2.11 error when checking IsEmpty (go-gitea#27393)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored and GiteaBot committed Oct 2, 2023
1 parent 28d970e commit a3a4add
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func (repo *Repository) IsEmpty() (bool, error) {
Stdout: &output,
Stderr: &errbuf,
}); err != nil {
if err.Error() == "exit status 1" && errbuf.String() == "" {
if (err.Error() == "exit status 1" || err.Error() == "exit status 129") && strings.TrimSpace(errbuf.String()) == "" {
// git 2.11 exits with 129 if the repo is empty
return true, nil
}
return true, fmt.Errorf("check empty: %w - %s", err, errbuf.String())
Expand Down

0 comments on commit a3a4add

Please sign in to comment.