mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-13 17:18:17 +01:00
Query git diff only when needed
In large git repo like chromium, it takes too long time to query git diff.
This commit is contained in:
parent
f0d936763c
commit
4e3ab4d399
@ -113,9 +113,13 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the Git modifications
|
// Get the Git modifications
|
||||||
let line_changes = match file {
|
let line_changes = if config.output_components.changes() {
|
||||||
InputFile::Ordinary(filename) => get_git_diff(filename),
|
match file {
|
||||||
_ => None,
|
InputFile::Ordinary(filename) => get_git_diff(filename),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine the type of syntax for highlighting
|
// Determine the type of syntax for highlighting
|
||||||
|
Loading…
Reference in New Issue
Block a user