aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-10-02 23:30:04 +0800
committerGitHub <noreply@github.com>2023-10-02 23:30:04 +0800
commitacedf0f702d7037c89b87384bc399141d5d0af98 (patch)
tree9397aa28eb07256b88c11c62ed95a98d8543c51f
parent23139aa27bbed804ca68b04b39f965a0ca69d277 (diff)
downloadgitea-acedf0f702d7037c89b87384bc399141d5d0af98.tar.gz
gitea-acedf0f702d7037c89b87384bc399141d5d0af98.zip
Fix git 2.11 error when checking IsEmpty (#27393) (#27396)
Backport #27393 by @wxiaoguang Fix #27389 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--modules/git/repo.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go
index 5681d39c3b..32f0e7007e 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -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())