Restore deleted branches when syncing (#29898)
Regression of #29493. If a branch has been deleted, repushing it won't restore it. Lunny may have noticed that, but I didn't delve into the comment then overlooked it: https://github.com/go-gitea/gitea/pull/29493#discussion_r1509046867 The additional comments added are to explain the issue I found during testing, which are unrelated to the fixes.
This commit is contained in:
parent
6ed2c29b14
commit
f371f84fa3
3 changed files with 24 additions and 5 deletions
|
@ -318,11 +318,11 @@ func SyncBranchesToDB(ctx context.Context, repoID, pusherID int64, branchNames,
|
|||
for i, branchName := range branchNames {
|
||||
commitID := commitIDs[i]
|
||||
branch, exist := branchMap[branchName]
|
||||
if exist && branch.CommitID == commitID {
|
||||
if exist && branch.CommitID == commitID && !branch.IsDeleted {
|
||||
continue
|
||||
}
|
||||
|
||||
commit, err := getCommit(branchName)
|
||||
commit, err := getCommit(commitID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get commit of %s failed: %v", branchName, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue