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 {
524
524
}
525
525
526
526
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 ) {
528
530
repo .DefaultBranch = refName
531
+ repo .IsBare = false
529
532
}
530
533
531
534
// Change repository bare status and update last updated time.
532
- repo .IsBare = repo .IsBare && opts .Commits .Len <= 0
533
535
if err = UpdateRepository (repo , false ); err != nil {
534
536
return fmt .Errorf ("UpdateRepository: %v" , err )
535
537
}
You can’t perform that action at this time.
0 commit comments