mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-28 08:05:55 +00:00
cargo fmt
This commit is contained in:
1 parent
d695ad8f88
commit
f9eed8d619
1 file changed
+3
-3
+3
-3
@@ -44,9 +44,9 @@ pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
|||||||
let filepath_absolute = filename.canonicalize().ok()?;
|
let filepath_absolute = filename.canonicalize().ok()?;
|
||||||
let repository = gix::discover(filepath_absolute.parent().ok()?).ok()?;
|
let repository = gix::discover(filepath_absolute.parent().ok()?).ok()?;
|
||||||
let repo_path_absolute = repository.workdir()?.canonicalize().ok()?;
|
let repo_path_absolute = repository.workdir()?.canonicalize().ok()?;
|
||||||
let filepath_relative_to_repo = gix::path::to_unix_separators_on_windows(
|
let filepath_relative_to_repo = gix::path::to_unix_separators_on_windows(gix::path::into_bstr(
|
||||||
gix::path::into_bstr(filepath_absolute.strip_prefix(&repo_path_absolute).ok()?)
|
filepath_absolute.strip_prefix(&repo_path_absolute).ok()?,
|
||||||
);
|
));
|
||||||
let index = repository.index_or_load_from_head_or_empty().ok()?;
|
let index = repository.index_or_load_from_head_or_empty().ok()?;
|
||||||
let index_entry = index.entry_by_path(filepath_relative_to_repo.as_ref())?;
|
let index_entry = index.entry_by_path(filepath_relative_to_repo.as_ref())?;
|
||||||
let mut cache = repository
|
let mut cache = repository
|
||||||
|
|||||||
Reference in new issue
Block a user