Formatting

This commit is contained in:
Scott Chacon 2023-07-19 10:57:40 +02:00 committed by Nikita Galaiko
parent 56ba838334
commit 59b0604d7e
2 changed files with 8 additions and 11 deletions

View File

@ -1896,9 +1896,7 @@ fn write_tree(
// it's a symlink, make the content the path of the link
let link_target = std::fs::read_link(&full_path)?;
// make link_target into a relative path
let link_target = link_target
.strip_prefix(project_repository.path())
.unwrap();
let link_target = link_target.strip_prefix(project_repository.path()).unwrap();
// create a blob where the content is that target path string
// make a [u8] out of the PathBuf
let path_str = link_target.to_str().unwrap();

View File

@ -1,6 +1,6 @@
use std::fs::{Permissions, self};
use std::{thread, time::Duration};
use std::fs::{self, Permissions};
use std::os::unix::fs::symlink;
use std::{thread, time::Duration};
use tempfile::tempdir;
@ -2428,7 +2428,6 @@ fn test_commit_add_and_delete_files() -> Result<()> {
Ok(())
}
#[test]
fn test_commit_executable_and_symlinks() -> Result<()> {
let repository = test_repository()?;
@ -2477,10 +2476,7 @@ fn test_commit_executable_and_symlinks() -> Result<()> {
// add executable
let file_path4 = std::path::Path::new("test4.bin");
let exec = std::path::Path::new(&project.path).join(file_path4);
std::fs::write(
&exec,
"exec\n",
)?;
std::fs::write(&exec, "exec\n")?;
let permissions = fs::metadata(&exec)?.permissions();
let new_permissions = Permissions::from_mode(permissions.mode() | 0o111); // Add execute permission
fs::set_permissions(&exec, new_permissions)?;
@ -2534,7 +2530,10 @@ fn tree_to_file_list(repository: &git2::Repository, tree: &git2::Tree) -> Result
Ok(file_list)
}
fn tree_to_entry_list(repository: &git2::Repository, tree: &git2::Tree) -> Result<Vec<(String, String, String)>> {
fn tree_to_entry_list(
repository: &git2::Repository,
tree: &git2::Tree,
) -> Result<Vec<(String, String, String)>> {
let mut file_list = Vec::new();
for entry in tree.iter() {
let path = entry.name().unwrap();