We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a68b39 commit c145cb7Copy full SHA for c145cb7
models/action.go
@@ -524,12 +524,14 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
524
}
525
526
refName := git.RefEndName(opts.RefFullName)
527
- if repo.IsBare && refName != repo.DefaultBranch {
+
528
+ // Change default branch and bare status only if pushed ref is non-empty branch.
529
+ if repo.IsBare && opts.NewCommitID != git.EmptySHA && strings.HasPrefix(opts.RefFullName, git.BranchPrefix) {
530
repo.DefaultBranch = refName
531
+ repo.IsBare = false
532
533
534
// Change repository bare status and update last updated time.
- repo.IsBare = repo.IsBare && opts.Commits.Len <= 0
535
if err = UpdateRepository(repo, false); err != nil {
536
return fmt.Errorf("UpdateRepository: %v", err)
537
0 commit comments