From dfa4e5857fe9d8f113cf50d4c7fda094f0f30b74 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 2 Oct 2023 23:59:39 +0800 Subject: [PATCH] Fix git 2.11 error when checking IsEmpty (again) (#27399) Follow #27393 Sorry that I made a mistake in #27393. The `errbuf` is not empty when the err is `exit status 129`. --- modules/git/repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/repo.go b/modules/git/repo.go index b216ecce3d..32f0e7007e 100644 --- a/modules/git/repo.go +++ b/modules/git/repo.go @@ -86,7 +86,7 @@ func (repo *Repository) IsEmpty() (bool, error) { Stdout: &output, Stderr: &errbuf, }); err != nil { - if (err.Error() == "exit status 1" || err.Error() == "exit status 129") && strings.TrimSpace(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 }