aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-08-17 12:43:39 +0800
committerGitHub <noreply@github.com>2023-08-17 04:43:39 +0000
commitc6b92c84fe5e4b1fad1711611d8a0d453fd7e311 (patch)
tree4114daa0285e49bf8d6ac51a416c0ec1942b0f43 /modules
parent16aee56e6a6a23d71465c703df796e6e8a274aad (diff)
downloadgitea-c6b92c84fe5e4b1fad1711611d8a0d453fd7e311.tar.gz
gitea-c6b92c84fe5e4b1fad1711611d8a0d453fd7e311.zip
Sync repo's IsEmpty status correctly (#26517)
Close #26509
Diffstat (limited to 'modules')
-rw-r--r--modules/git/repo.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go
index 61930ab31d..5681d39c3b 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -80,7 +80,7 @@ func InitRepository(ctx context.Context, repoPath string, bare bool) error {
// IsEmpty Check if repository is empty.
func (repo *Repository) IsEmpty() (bool, error) {
var errbuf, output strings.Builder
- if err := NewCommand(repo.Ctx).AddOptionFormat("--git-dir=%s", repo.Path).AddArguments("show-ref", "--head", "^HEAD$").
+ if err := NewCommand(repo.Ctx).AddOptionFormat("--git-dir=%s", repo.Path).AddArguments("rev-list", "-n", "1", "--all").
Run(&RunOpts{
Dir: repo.Path,
Stdout: &output,