Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ fn git(root: Option<&Path>, args: &[&str]) -> Result<String, String> {
if let Some(r) = root {
cmd.arg("-C").arg(r);
}
cmd.args(["-c", "color.ui=false"]);
let out = cmd
.args(args)
.output()
Expand Down
13 changes: 13 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,19 @@ fn since_lists_only_lines_the_branch_introduced() {
assert!(!json.contains("// pre-existing narration"), "{json}");
}

#[test]
fn since_ignores_a_forced_color_git_config() {
let Some((d, base)) = repo_with_base("a.rs", BASE_RS) else { return };
git_in(&d, &["config", "color.ui", "always"]);
write_in(&d, "a.rs", &format!("{BASE_RS}// brand new narration\nfn b() {{}}\n"));

let out = run(&[d.to_str().unwrap(), "--list", "--since", &base]);
assert!(out.status.success(), "stderr: {:?}", out.stderr);
let json = String::from_utf8(out.stdout).unwrap();
assert!(json.contains("// brand new narration"), "{json}");
assert!(!json.contains("// pre-existing narration"), "{json}");
}

#[test]
fn since_strips_only_lines_the_branch_introduced() {
let Some((d, base)) = repo_with_base("a.rs", BASE_RS) else { return };
Expand Down