Query git diff only when needed
In large git repo like chromium, it takes too long time to query git
diff.
commit4e3ab4d39915979592c23318bbdb9b5c43b7b9ea
authorshik Chen <shik.chen@gmail.com>
dateTue 11 Sep 2018, 14:47 (8 years ago)
parentf0d9367
src/printer.rs+7−3
@@ -113,9 +113,13 @@ impl<'a> InteractivePrinter<'a> {
113113 }
114114
115115 // Get the Git modifications
116− let line_changes = match file {
117− InputFile::Ordinary(filename) => get_git_diff(filename),
118− _ => None,
116+ let line_changes = if config.output_components.changes() {
117+ match file {
118+ InputFile::Ordinary(filename) => get_git_diff(filename),
119+ _ => None,
120+ }
121+ } else {
122+ None
119123 };
120124
121125 // Determine the type of syntax for highlighting