fix: assure we convert worktree data to Git before writing it (#5558)#5564
Merged
Byron merged 3 commits intogitbutlerapp:masterfrom Nov 17, 2024
Merged
fix: assure we convert worktree data to Git before writing it (#5558)#5564Byron merged 3 commits intogitbutlerapp:masterfrom
Byron merged 3 commits intogitbutlerapp:masterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@Byron is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
277ec1f to
4645ad2
Compare
Comment on lines
+257
to
+261
| let mut file_for_git = | ||
| pipeline.convert_to_git(std::fs::File::open(&file_path)?, path, &index)?; | ||
| buf.clear(); | ||
| std::io::copy(&mut file_for_git, &mut buf)?; | ||
| let blob_id = self.blob(&buf)?; |
Contributor
There was a problem hiding this comment.
Why do we want to copy the data into the buffer and not just directly pass it to self.blob?
Collaborator
Author
There was a problem hiding this comment.
file_for_git isn't a buffer, it's something that implements std::io::Read, while blob() takes &[u8].
This is the version of the code that is easiest to write, but also slowest as two out of three cases already have a buffer underneath which could be passed directly.
I will adjust it to be the most efficient possible.
That way, if a buffer is already present, we just write that directly.
Caleb-T-Owens
approved these changes
Nov 17, 2024
Contributor
Caleb-T-Owens
left a comment
There was a problem hiding this comment.
Thanks, looks good to me 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #5558
Tasks
Notes for the reviewer
git2::Repository::blob_writer(path)which automatically applies the 'worktree-to-git' filtering as well. That would lead to simpler code, at least, but will have disadvantages in correctness as it doesn't support external filters, nor will it pick up all the configuration.gitoxidemakes these the default for good measure - right now it prefers performance as that option involves launchinggitto have it tell us where its installation configuration is located. In future, I can see that shift as more features will only work correctly in with this option enabled.