Compare commits
No commits in common. "df4b44eba12e1cc3a0d1db261c353cbaa4eca74b" and "5f830049dd5a90fc4346419964d7073bf5a05273" have entirely different histories.
df4b44eba1
...
5f830049dd
|
|
@ -449,7 +449,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git-heatmap"
|
name = "git-heatmap"
|
||||||
version = "1.4.2"
|
version = "1.4.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ cargo-features = ["codegen-backend"]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "git-heatmap"
|
name = "git-heatmap"
|
||||||
version = "1.4.2"
|
version = "1.4.1"
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,6 @@ 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("use-author-time"), default_value_t = false)]
|
|
||||||
pub use_author_time: 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,
|
||||||
|
|
||||||
|
|
|
||||||
48
src/lib.rs
48
src/lib.rs
|
|
@ -180,7 +180,6 @@ pub fn get_commits(
|
||||||
});
|
});
|
||||||
|
|
||||||
let repo = repo.to_thread_local();
|
let repo = repo.to_thread_local();
|
||||||
let mut cached_commits: Vec<Commit> = vec![];
|
|
||||||
|
|
||||||
let branch_commits = branch_commits
|
let branch_commits = branch_commits
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
@ -205,30 +204,9 @@ 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 = if args.use_author_time {
|
|
||||||
author.time().ok()?
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c.time().ok()?
|
|
||||||
};
|
|
||||||
let time =
|
|
||||||
DateTime::from_timestamp_millis(time.seconds * 1000)?.with_timezone(&Local);
|
|
||||||
if time < start_date || time > end_date {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let author = Author { name, email };
|
let author = Author { name, email };
|
||||||
let author = mailmap.resolve(author);
|
let author = mailmap.resolve(author);
|
||||||
|
|
||||||
|
|
@ -236,28 +214,20 @@ pub fn get_commits(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let commit = Commit {
|
let time = c.time().ok()?;
|
||||||
|
let time =
|
||||||
|
DateTime::from_timestamp_millis(time.seconds * 1000)?.with_timezone(&Local);
|
||||||
|
if time < start_date || time > end_date {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(Commit {
|
||||||
id: c.id,
|
id: c.id,
|
||||||
title,
|
title,
|
||||||
author,
|
author,
|
||||||
repo: repo_name.to_string(),
|
repo: repo_name.to_string(),
|
||||||
time,
|
time,
|
||||||
};
|
})
|
||||||
|
|
||||||
if args.use_author_time {
|
|
||||||
for other in &cached_commits {
|
|
||||||
if other.author == commit.author
|
|
||||||
&& other.title == commit.title
|
|
||||||
&& other.time == commit.time
|
|
||||||
{
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cached_commits.push(commit.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(commit)
|
|
||||||
})
|
})
|
||||||
.collect_vec();
|
.collect_vec();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue