Improve sync fork behavior (#33319) (#33332)

Backport #33319
Fix #33271

The only conflict is `reqctx` in
`services/repository/merge_upstream.go`, which could keep using
`context.Context` in 1.23
This commit is contained in:
wxiaoguang 2025-01-20 15:50:38 +08:00 committed by GitHub
parent e72d001708
commit 8f45a11919
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 108 additions and 24 deletions

View file

@ -167,6 +167,9 @@ func GetBranch(ctx context.Context, repoID int64, branchName string) (*Branch, e
BranchName: branchName,
}
}
// FIXME: this design is not right: it doesn't check `branch.IsDeleted`, it doesn't make sense to make callers to check IsDeleted again and again.
// It causes inconsistency with `GetBranches` and `git.GetBranch`, and will lead to strange bugs
// In the future, there should be 2 functions: `GetBranchExisting` and `GetBranchWithDeleted`
return &branch, nil
}