mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 22:53:54 +03:00
Commitless repos should be bare
This commit is contained in:
parent
e67ece26f0
commit
c85ff532e9
2 changed files with 5 additions and 1 deletions
|
@ -517,7 +517,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
|
|||
}
|
||||
|
||||
// Change repository bare status and update last updated time.
|
||||
repo.IsBare = false
|
||||
repo.IsBare = repo.IsBare && opts.Commits.Len <= 0
|
||||
if err = UpdateRepository(repo, false); err != nil {
|
||||
return fmt.Errorf("UpdateRepository: %v", err)
|
||||
}
|
||||
|
|
|
@ -392,6 +392,10 @@ func RepoRef() macaron.Handler {
|
|||
if err != nil {
|
||||
ctx.Handle(500, "GetBranches", err)
|
||||
return
|
||||
} else if len(brs) == 0 {
|
||||
err = fmt.Errorf("No branches in non-bare repository %s",
|
||||
ctx.Repo.GitRepo.Path)
|
||||
ctx.Handle(500, "GetBranches", err)
|
||||
}
|
||||
refName = brs[0]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue