@@ -21,11 +21,11 @@ use unicode_width::UnicodeWidthChar;
2121
2222use crate::assets::HighlightingAssets;
2323use crate::config::Config;
24−use crate::decorations::{
25− Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration,
26−};
27−use crate::diff::get_git_diff;
28−use crate::diff::LineChanges;
24+use crate::decorations::{Decoration, GridBorderDecoration, LineNumberDecoration};
25+#[cfg(feature = "git")]
26+use crate::decorations::LineChangesDecoration;
27+#[cfg(feature = "git")]
28+use crate::diff::{get_git_diff, LineChanges};
2929use crate::errors::*;
3030use crate::inputfile::{InputFile, InputFileReader};
3131use crate::line_range::RangeCheckResult;
@@ -100,6 +100,7 @@ pub struct InteractivePrinter<'a> {
100100 panel_width: usize,
101101 ansi_prefix_sgr: String,
102102 content_type: Option<ContentType>,
103+ #[cfg(feature = "git")]
103104 pub line_changes: Option<LineChanges>,
104105 highlighter: Option<HighlightLines<'a>>,
105106 syntax_set: &'a SyntaxSet,
@@ -130,8 +131,11 @@ impl<'a> InteractivePrinter<'a> {
130131 decorations.push(Box::new(LineNumberDecoration::new(&colors)));
131132 }
132133
133− if config.style_components.changes() {
134− decorations.push(Box::new(LineChangesDecoration::new(&colors)));
134+ #[cfg(feature = "git")]
135+ {
136+ if config.style_components.changes() {
137+ decorations.push(Box::new(LineChangesDecoration::new(&colors)));
138+ }
135139 }
136140
137141 let mut panel_width: usize =
@@ -153,6 +157,7 @@ impl<'a> InteractivePrinter<'a> {
153157 panel_width = 0;
154158 }
155159
160+ #[cfg(feature = "git")]
156161 let mut line_changes = None;
157162
158163 let highlighter = if reader
@@ -162,14 +167,14 @@ impl<'a> InteractivePrinter<'a> {
162167 None
163168 } else {
164169 // Get the Git modifications
165− line_changes = if config.style_components.changes() {
166− match file {
167− InputFile::Ordinary(filename) => get_git_diff(filename),
168− _ => None,
170+ #[cfg(feature = "git")]
171+ {
172+ if config.style_components.changes() {
173+ if let InputFile::Ordinary(filename) = file {
174+ line_changes = get_git_diff(filename);
175+ }
169176 }
170− } else {
171− None
172− };
177+ }
173178
174179 // Determine the type of syntax for highlighting
175180 let syntax = assets.get_syntax(config.language, file, reader, &config.syntax_mapping);
@@ -183,6 +188,7 @@ impl<'a> InteractivePrinter<'a> {
183188 decorations,
184189 content_type: reader.content_type,
185190 ansi_prefix_sgr: String::new(),
191+ #[cfg(feature = "git")]
186192 line_changes,
187193 highlighter,
188194 syntax_set: &assets.syntax_set,