Skip to content

Conversation

niik
Copy link
Member

@niik niik commented Nov 27, 2024

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 uses spawnGit. I was pleasantly surprised to find that in the time that's passed since we initially wrote determineMergeability there's been some great improvements to git-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 ran git 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 the p-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:

Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 This appears to work as expected (and faster) and makes sense.

@niik niik merged commit c6d71b3 into development Dec 9, 2024
9 checks passed
@niik niik deleted the merge-tree-perf branch December 9, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Number of merge conflicts are incorrect in merge hint
2 participants