Skip to content

Conversation

@Byron
Copy link
Collaborator

@Byron Byron commented Nov 15, 2024

Fixes #5558

Tasks

  • first implementation
  • assure that on Windows it will also read the installation-configuration to definitely get all the settings

Notes for the reviewer

  • One could also use 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.
  • These special open-options would probably have to be used in more places, or gitoxide makes these the default for good measure - right now it prefers performance as that option involves launching git to 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.

@vercel
Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 16, 2024 10:38am

@vercel
Copy link

vercel bot commented Nov 15, 2024

@Byron is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

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)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to copy the data into the buffer and not just directly pass it to self.blob?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.
Copy link
Contributor

@Caleb-T-Owens Caleb-T-Owens left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me 👍

@Byron Byron merged commit b42a9b7 into gitbutlerapp:master Nov 17, 2024
19 of 20 checks passed
@Byron Byron deleted the convert-to-git branch November 17, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rebase in gitbutler cause conflicts with line endings when autocrlf is set to true

2 participants