-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Refactor compare router param parse and fix bugs #36105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: techknowlogick <[email protected]> Signed-off-by: Lunny Xiao <[email protected]>
|
please have a look at #36116 |
This has been included and it's ready to review now. |
This will be partially backport. Only bugfixes will be backport. |
…lunny/refactor_compare
Signed-off-by: wxiaoguang <[email protected]>
| if routerParam == "" { | ||
| return &CompareRouterReq{}, nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it valid argument?
What will &CompareRouterReq{} compare?
|
|
||
| ci.BaseBranch = util.Iif(compareReq.BaseOriRef == "", baseRepo.DefaultBranch, compareReq.BaseOriRef) | ||
| ci.HeadBranch = util.Iif(compareReq.HeadOriRef == "", ci.HeadRepo.DefaultBranch, compareReq.HeadOriRef) | ||
| ci.DirectComparison = compareReq.DirectComparison() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use ci (parse the route parameter into CompareInfo) ? What's the purpose of passing compareReq into ci?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's easier to write the unit test for the router param parsing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see why it is "easier"
Now you have 3 different structs for the same purpose:
- CompareRouterReq
- parseCompareInfoResult
- CompareInfo
Fix #36116
Fix #35912
Fix #20906