We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea20ada commit 10a2a90Copy full SHA for 10a2a90
models/action.go
@@ -537,12 +537,14 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
537
}
538
539
refName := git.RefEndName(opts.RefFullName)
540
- if repo.IsBare && refName != repo.DefaultBranch {
+
541
+ // Change default branch and bare status only if pushed ref is non-empty branch.
542
+ if repo.IsBare && opts.NewCommitID != git.EmptySHA && strings.HasPrefix(opts.RefFullName, git.BranchPrefix) {
543
repo.DefaultBranch = refName
544
+ repo.IsBare = false
545
546
547
// Change repository bare status and update last updated time.
- repo.IsBare = repo.IsBare && opts.Commits.Len <= 0
548
if err = UpdateRepository(repo, false); err != nil {
549
return fmt.Errorf("UpdateRepository: %v", err)
550
0 commit comments