Added a test option for ignoring commits with different commit / author times

master
Wynd 2025-09-06 00:06:28 +03:00
parent 5f830049dd
commit 38daf4ac4c
4 changed files with 17 additions and 3 deletions

2
Cargo.lock generated
View File

@ -449,7 +449,7 @@ dependencies = [
[[package]] [[package]]
name = "git-heatmap" name = "git-heatmap"
version = "1.4.1" version = "1.4.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@ -2,7 +2,7 @@ cargo-features = ["codegen-backend"]
[package] [package]
name = "git-heatmap" name = "git-heatmap"
version = "1.4.1" version = "1.4.2"
edition = "2024" edition = "2024"
authors = ["Wynd <wyndftw@proton.me>"] authors = ["Wynd <wyndftw@proton.me>"]
description = "A simple and customizable heatmap for git repos" description = "A simple and customizable heatmap for git repos"

View File

@ -48,6 +48,10 @@ pub struct CliArgs {
#[arg(long("no-merges"), default_value_t = false)] #[arg(long("no-merges"), default_value_t = false)]
pub no_merges: bool, pub no_merges: bool,
// Experimental
#[arg(long("no-diff"), default_value_t = false)]
pub no_diff: bool,
#[arg(long("counting"), value_enum, default_value_t = ColorLogic::ByWeight)] #[arg(long("counting"), value_enum, default_value_t = ColorLogic::ByWeight)]
pub counting: ColorLogic, pub counting: ColorLogic,

View File

@ -204,8 +204,18 @@ pub fn get_commits(
let author = c.author().ok()?; let author = c.author().ok()?;
// Ignores commits with different commit / author times
// Usually due to rebases or cherry picking, however other edge cases may apply too
if args.no_diff {
let commit_info = c.committer().unwrap();
if commit_info.time != author.time {
return None;
}
}
let email = author.email.to_string(); let email = author.email.to_string();
let name = author.name.to_string(); let name = author.name.to_string();
// let time = author.time().unwrap();
let author = Author { name, email }; let author = Author { name, email };
let author = mailmap.resolve(author); let author = mailmap.resolve(author);