Browse Source

Fix git 2.11 error when checking IsEmpty (#27393) (#27397)

Backport #27393 by @wxiaoguang

Fix #27389

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
tags/v1.21.0-rc1
Giteabot 8 months ago
parent
commit
7dc5ab2e95
No account linked to committer's email address
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      modules/git/repo.go

+ 2
- 1
modules/git/repo.go View File

@@ -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" && strings.TrimSpace(errbuf.String()) == "") || err.Error() == "exit status 129" {
// 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())

Loading…
Cancel
Save