mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 09:04:26 +00:00
Fix bug when repo remained bare if multiple branches pushed (#4923)
This commit is contained in:
parent
ea20adaa84
commit
10a2a904d7
@ -537,12 +537,14 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refName := git.RefEndName(opts.RefFullName)
|
refName := git.RefEndName(opts.RefFullName)
|
||||||
if repo.IsBare && refName != repo.DefaultBranch {
|
|
||||||
|
// Change default branch and bare status only if pushed ref is non-empty branch.
|
||||||
|
if repo.IsBare && opts.NewCommitID != git.EmptySHA && strings.HasPrefix(opts.RefFullName, git.BranchPrefix) {
|
||||||
repo.DefaultBranch = refName
|
repo.DefaultBranch = refName
|
||||||
|
repo.IsBare = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change repository bare status and update last updated time.
|
// Change repository bare status and update last updated time.
|
||||||
repo.IsBare = repo.IsBare && opts.Commits.Len <= 0
|
|
||||||
if err = UpdateRepository(repo, false); err != nil {
|
if err = UpdateRepository(repo, false); err != nil {
|
||||||
return fmt.Errorf("UpdateRepository: %v", err)
|
return fmt.Errorf("UpdateRepository: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user