mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-08 14:22:25 +01:00
Improve readability
Using `Path`s for paths expresses intent more clearly.
This commit is contained in:
committed by
David Peter
parent
b489fc75c9
commit
35347c2310
@@ -1,7 +1,6 @@
|
||||
#![cfg(feature = "git")]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -17,7 +16,7 @@ pub enum LineChange {
|
||||
|
||||
pub type LineChanges = HashMap<u32, LineChange>;
|
||||
|
||||
pub fn get_git_diff(filename: &OsStr) -> Option<LineChanges> {
|
||||
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
||||
let repo = Repository::discover(&filename).ok()?;
|
||||
|
||||
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
||||
|
Reference in New Issue
Block a user