mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-16 02:00:02 +02:00
Backport #26517 by @wxiaoguang Close #26509 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 7da85fa0c3d7ddf4907ca74ef81ee532d768df87)
This commit is contained in:
parent
44658b7d2c
commit
4ac522c8aa
3 changed files with 10 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue