aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-10-02 22:05:21 +0800
committerGitHub <noreply@github.com>2023-10-02 22:05:21 +0800
commitcaef9f950334c95c4b6e2f362fa6766c317419ea (patch)
treeb7441c77c4cb5f447177db1c0c1009c427908020 /modules
parent624c0ba920d8e01933f2be40797fa0c768378b89 (diff)
downloadgitea-caef9f950334c95c4b6e2f362fa6766c317419ea.tar.gz
gitea-caef9f950334c95c4b6e2f362fa6766c317419ea.zip
Fix git 2.11 error when checking IsEmpty (#27393)
Fix #27389
Diffstat (limited to 'modules')
-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..b216ecce3d 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" || 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())