File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -537,12 +537,14 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
537537 }
538538
539539 refName := git .RefEndName (opts .RefFullName )
540- if repo .IsBare && refName != repo .DefaultBranch {
540+
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 ) {
541543 repo .DefaultBranch = refName
544+ repo .IsBare = false
542545 }
543546
544547 // Change repository bare status and update last updated time.
545- repo .IsBare = repo .IsBare && opts .Commits .Len <= 0
546548 if err = UpdateRepository (repo , false ); err != nil {
547549 return fmt .Errorf ("UpdateRepository: %v" , err )
548550 }
You can’t perform that action at this time.
0 commit comments