-
-
Couldn't load subscription status.
- Fork 6.2k
Use merge tree to improve conflict checking performance when possible #35542
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
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.
All old code (for SupportGitMergeTree=false) loses there test coverage?
…tea into lunny/merge_tree_conflict_check
All of these have been resolved. |
…tea into lunny/merge_tree_conflict_check
| return false | ||
| } | ||
|
|
||
| func ExitCode(err error) (int, bool) { |
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.
You don't need such duplicate function
| // It uses 'git merge-tree' if supported by the Git version, otherwise it falls back to using a temporary repository. | ||
| // This function updates the pr.Status, pr.MergeBase and pr.ConflictedFiles fields as necessary. | ||
| // The pull request parameter may not be created yet in the database, so do not assume it has an ID. | ||
| func checkPullRequestMergeableAndUpdateStatus(ctx context.Context, pr *issues_model.PullRequest) error { |
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.
I have told you, you need to clearly test this function's behavior, but not keep copy-pasting or polluting other unrelated tests
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.
Not maintainable
I don't see how Integration test can be used to make sure "everything works well together", it shouldn't and is not able to be used to test a specific function for its all edge cases. |
In Git 2.38, the
merge-treecommand introduced the--write-treeoption, which works directly on bare repositories. This option produces the merged tree object ID, allowing us to perform diffs between commits without creating a temporary repository. By avoiding the overhead of setting up and tearing down temporary repos, this approach delivers a notable performance improvement.