mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
fix test
This commit is contained in:
parent
6ca1eb05e8
commit
99fc7a7b32
1 changed files with 11 additions and 7 deletions
|
|
@ -185,15 +185,19 @@ pub fn get_diff(repo_path: &str, p: String, stage: bool) -> Diff {
|
||||||
fn new_file_content(path: &Path) -> String {
|
fn new_file_content(path: &Path) -> String {
|
||||||
if let Ok(meta) = fs::symlink_metadata(path) {
|
if let Ok(meta) = fs::symlink_metadata(path) {
|
||||||
if meta.file_type().is_symlink() {
|
if meta.file_type().is_symlink() {
|
||||||
fs::read_link(path).unwrap().to_str().unwrap().to_string()
|
return fs::read_link(path)
|
||||||
} else {
|
.unwrap()
|
||||||
"file not found".to_string()
|
.to_str()
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
} else if meta.file_type().is_file() {
|
||||||
|
if let Ok(content) = fs::read_to_string(path) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if let Ok(content) = fs::read_to_string(path) {
|
|
||||||
content
|
|
||||||
} else {
|
|
||||||
"file not found".to_string()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"file not found".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue