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 @@ -524,12 +524,14 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
524524 }
525525
526526 refName := git .RefEndName (opts .RefFullName )
527- if repo .IsBare && refName != repo .DefaultBranch {
527+
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 ) {
528530 repo .DefaultBranch = refName
531+ repo .IsBare = false
529532 }
530533
531534 // Change repository bare status and update last updated time.
532- repo .IsBare = repo .IsBare && opts .Commits .Len <= 0
533535 if err = UpdateRepository (repo , false ); err != nil {
534536 return fmt .Errorf ("UpdateRepository: %v" , err )
535537 }
You can’t perform that action at this time.
0 commit comments