mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-14 01:35:55 +09:00
Backport #26517 by @wxiaoguang Close #26509 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
1 parent
0ac8b774e9
commit
7da85fa0c3
3 files changed
+10
-4
No files matched your search
+1
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user