diff options
author | Jason Song <i@wolfogre.com> | 2024-03-20 09:45:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-20 01:45:27 +0000 |
commit | f371f84fa3456c2a71470632b6458d81e4892a54 (patch) | |
tree | e990d52565b3b585a4b780edf7c82f02c7bf3aa4 /services/repository/branch.go | |
parent | 6ed2c29b1459daa6e7b0cf63b9c08fd9c001ac09 (diff) | |
download | gitea-f371f84fa3456c2a71470632b6458d81e4892a54.tar.gz gitea-f371f84fa3456c2a71470632b6458d81e4892a54.zip |
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.
Diffstat (limited to 'services/repository/branch.go')
-rw-r--r-- | services/repository/branch.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/services/repository/branch.go b/services/repository/branch.go index 8d8cfa2d19..db7acdb505 100644 --- a/services/repository/branch.go +++ b/services/repository/branch.go @@ -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) } |