Accurately calculate number of conflicted files in a merge #19626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #8049
Description
Here's little bonus PR at the tail end of the Git large output work. I've been eyeing our
determineMergeability
function because it's the only remaining function which usesspawnGit
. I was pleasantly surprised to find that in the time that's passed since we initially wrotedetermineMergeability
there's been some great improvements togit-merge-tree
.Most importantly that it's able to perform "real merges" (
--write-tree
), i.e. the exact same merge that would occur if you rangit merge
in the terminal except that it won't touch the index or the working directory. This is what we've been looking for to resolve #8049.The merge will be done in memory and the resulting tree will be written to disk but unless a merge occurs it will be dangling and cleaned up on the next garbage collection.
And thanks to
--name-only
and-z
we can get rid of all logic to parse diffs looking for conflicts markers and let Git do the work for us 🎉I also removed our
promiseWithTimeout
"hack" and added an asynchronous cache (adding thep-memoization
library instead of rolling our own) which will ensure we don't have to recalculate the merge tree when the user clicks around in the merge dialog.Screenshots
Release notes
Notes: