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 {
537
537
}
538
538
539
539
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 ) {
541
543
repo .DefaultBranch = refName
544
+ repo .IsBare = false
542
545
}
543
546
544
547
// Change repository bare status and update last updated time.
545
- repo .IsBare = repo .IsBare && opts .Commits .Len <= 0
546
548
if err = UpdateRepository (repo , false ); err != nil {
547
549
return fmt .Errorf ("UpdateRepository: %v" , err )
548
550
}
You can’t perform that action at this time.
0 commit comments