Skip to content

Commit bb57629

Browse files
committed
output of "git diff" is better, and is what I use mostly
1 parent 3aaf4e1 commit bb57629

File tree

3 files changed

+0
-44
lines changed

3 files changed

+0
-44
lines changed

ci/sembr/Cargo.lock

Lines changed: 0 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci/sembr/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ edition = "2024"
55
[dependencies]
66
anyhow = "1"
77
ignore = "0.4"
8-
imara-diff = "0.2"
98

109
[dependencies.regex]
1110
version = "1"

ci/sembr/src/main.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::{fs, process};
55
use anyhow::Result;
66
use clap::Parser;
77
use ignore::Walk;
8-
use imara_diff::{Algorithm, BasicLineDiffPrinter, Diff, InternedInput, UnifiedDiffConfig};
98
use regex::Regex;
109

1110
#[derive(Parser)]
@@ -18,8 +17,6 @@ struct Cli {
1817
/// Applies to lines that are to be split
1918
#[arg(long, default_value_t = 100)]
2019
line_length_limit: usize,
21-
#[arg(long)]
22-
show_diff: bool,
2320
}
2421

2522
static REGEX_IGNORE_END: LazyLock<Regex> =
@@ -54,10 +51,6 @@ fn main() -> Result<()> {
5451
} else if cli.overwrite {
5552
fs::write(&path, new)?;
5653
made_compliant.push(path.clone());
57-
} else if cli.show_diff {
58-
println!("{}:", path.display());
59-
show_diff(&old, &new);
60-
println!("---");
6154
} else {
6255
not_compliant.push(path.clone());
6356
}
@@ -76,16 +69,6 @@ fn main() -> Result<()> {
7669
Ok(())
7770
}
7871

79-
fn show_diff(old: &str, new: &str) {
80-
let input = InternedInput::new(old, new);
81-
let mut diff = Diff::compute(Algorithm::Histogram, &input);
82-
diff.postprocess_lines(&input);
83-
let diff = diff
84-
.unified_diff(&BasicLineDiffPrinter(&input.interner), UnifiedDiffConfig::default(), &input)
85-
.to_string();
86-
print!("{diff}");
87-
}
88-
8972
fn display(header: &str, paths: &[PathBuf]) {
9073
println!("{header}:");
9174
for element in paths {

0 commit comments

Comments
 (0)