GitButler Integration Commit

This is an integration commit for the virtual branches that GitButler is tracking.

Due to GitButler managing multiple virtual branches, you cannot switch back and
forth between git branches and virtual branches easily. 

If you switch to another branch, GitButler will need to be reinitialized.
If you commit on this branch, GitButler will throw it away.

Here are the branches that are currently applied:
 - Virtual branch 7 (refs/gitbutler/Virtual-branch-7)
   branch head: 8111cbe7994127d7c50f2ba164d06ae34f1dd302
   - gitbutler-app/src/project_repository/conflicts.rs
   - gitbutler-app/src/virtual_branches/virtual.rs
 - Virtual branch 8 (refs/gitbutler/Virtual-branch-8)
   - gitbutler-app/src/project_repository/conflicts.rs

Your previous branch was: refs/heads/exec-stuff

The sha for that commit was: 2bd1e8748628648e96d925b3bdba7572ce9ae734

For more information about what we're doing here, check out our docs:
https://docs.gitbutler.com/features/virtual-branches/integration-branch
This commit is contained in:
GitButler 2024-03-13 15:31:04 +01:00
parent 95fdf64db8
commit c9f7ea0494

View File

@ -21,8 +21,8 @@ pub fn mark(repository: &Repository, paths: &[String], parent: Option<git::Oid>)
// write all the file paths to a file on disk
let mut file = std::fs::File::create(conflicts_path)?;
for path in paths {
file.write_all(path.as_bytes()).unwrap();
file.write_all(b"\n").unwrap();
file.write_all(path.as_ref().as_os_str().as_encoded_bytes())?;
file.write_all(b"\n")?;
}
if let Some(parent) = parent {
@ -85,7 +85,7 @@ pub fn conflicting_files(repository: &Repository) -> Result<Vec<String>> {
Ok(reader.lines().map_while(Result::ok).collect())
}
pub fn is_conflicting(repository: &Repository, path: Option<&str>) -> Result<bool> {
pub fn is_conflicting<P: AsRef<Path>>(repository: &Repository, path: Option<P>) -> Result<bool> {
let conflicts_path = repository.git_repository.path().join("conflicts");
if !conflicts_path.exists() {
return Ok(false);
@ -103,7 +103,7 @@ pub fn is_conflicting(repository: &Repository, path: Option<&str>) -> Result<boo
}
Ok(false)
} else {
Ok(!files.is_empty())
Ok(files.next().transpose().map(|x| x.is_some())?)
}
}