From faa6b17fcc4e76565ec4835b61921cf11287c6ac Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 2 Feb 2026 00:24:09 +0000 Subject: [PATCH 1/2] Include full history in repo stats Co-authored-by: kylewrader --- Cargo.toml | 2 +- README.md | 2 +- src/main.rs | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ef151d2..37301c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loki-cli" -version = "1.7.0" +version = "1.8.0" authors = ["Kyle W. Rader"] description = "Loki: 🚀 A Git productivity tool" homepage = "https://github.com/kyle-rader/loki-cli" diff --git a/README.md b/README.md index f46a68a..ae01c56 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ lk x -- commit -m "Update Readme without running hooks" ``` ### `repo stats` -Analyze first-parent commits to see who has been landing work in a repository. All of the filtering flags operate on commit dates. +Analyze commits reachable from HEAD to see who has been landing work in a repository. All of the filtering flags operate on commit dates. - `--name` filters by author display name (repeatable, case-insensitive). - `--email` filters by author email (repeatable, case-insensitive). diff --git a/src/main.rs b/src/main.rs index 8cdc4db..e76ad03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,7 +85,7 @@ struct RepoStatsOptions { #[derive(Debug, Subcommand)] enum RepoSubcommand { - /// Analyze first-parent commits by author over time. + /// Analyze commits by author over time. #[clap(name = "stats")] Stats(RepoStatsOptions), } @@ -233,7 +233,6 @@ fn repo_stats(options: &RepoStatsOptions) -> Result<(), String> { let mut git_args: Vec = vec![ "log".to_string(), - "--first-parent".to_string(), "--pretty=format:%ct%x09%an%x09%ae".to_string(), ]; if let Some(start_ts) = range.start_ts { @@ -340,7 +339,7 @@ fn repo_stats(options: &RepoStatsOptions) -> Result<(), String> { if totals.is_empty() { println!( - "No first-parent commits found between {} and {}.", + "No commits found between {} and {}.", range.start_label, range.end_label ); return Ok(()); From dc11c2647422ecb5a23f31a99fd95124c680f0a8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 2 Feb 2026 00:34:26 +0000 Subject: [PATCH 2/2] Add optional first-parent flag to repo stats Co-authored-by: kylewrader --- Cargo.toml | 2 +- README.md | 1 + src/main.rs | 28 ++++++++++++++++++++-------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 37301c9..128ccfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "loki-cli" -version = "1.8.0" +version = "1.9.0" authors = ["Kyle W. Rader"] description = "Loki: 🚀 A Git productivity tool" homepage = "https://github.com/kyle-rader/loki-cli" diff --git a/README.md b/README.md index ae01c56..fbe00ca 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Analyze commits reachable from HEAD to see who has been landing work in a reposi - `--name` filters by author display name (repeatable, case-insensitive). - `--email` filters by author email (repeatable, case-insensitive). +- `--first-parent` limits the analysis to first-parent commits. #### Example ``` diff --git a/src/main.rs b/src/main.rs index e76ad03..08d6f7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,6 +73,10 @@ struct RepoStatsOptions { #[clap(long, default_value_t = 20)] top: usize, + /// Only include first-parent commits. + #[clap(long, default_value = "false")] + first_parent: bool, + /// Only include commits authored by these names (repeatable, case-insensitive fuzzy match). #[clap(long = "name", value_name = "NAME")] names: Vec, @@ -231,10 +235,11 @@ fn repo_stats(options: &RepoStatsOptions) -> Result<(), String> { let email_filters_lower: Vec = options.emails.iter().map(|s| s.to_lowercase()).collect(); - let mut git_args: Vec = vec![ - "log".to_string(), - "--pretty=format:%ct%x09%an%x09%ae".to_string(), - ]; + let mut git_args: Vec = vec!["log".to_string()]; + if options.first_parent { + git_args.push("--first-parent".to_string()); + } + git_args.push("--pretty=format:%ct%x09%an%x09%ae".to_string()); if let Some(start_ts) = range.start_ts { git_args.push(format!("--since=@{start_ts}")); } @@ -338,10 +343,17 @@ fn repo_stats(options: &RepoStatsOptions) -> Result<(), String> { progress.finish(); if totals.is_empty() { - println!( - "No commits found between {} and {}.", - range.start_label, range.end_label - ); + if options.first_parent { + println!( + "No first-parent commits found between {} and {}.", + range.start_label, range.end_label + ); + } else { + println!( + "No commits found between {} and {}.", + range.start_label, range.end_label + ); + } return Ok(()); }