diff --git a/gitoxide-core/src/repository/blame.rs b/gitoxide-core/src/repository/blame.rs index 2d2930b30dd..04744515343 100644 --- a/gitoxide-core/src/repository/blame.rs +++ b/gitoxide-core/src/repository/blame.rs @@ -5,7 +5,7 @@ use std::ffi::OsStr; pub fn blame_file( mut repo: gix::Repository, file: &OsStr, - range: Option>, + options: gix::blame::Options, out: impl std::io::Write, err: Option<&mut dyn std::io::Write>, ) -> anyhow::Result<()> { @@ -44,7 +44,7 @@ pub fn blame_file( cache, &mut resource_cache, file.as_bstr(), - range, + options, )?; let statistics = outcome.statistics; write_blame_entries(out, outcome)?; diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index b17a6b3a1e2..337bbce66bf 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -1546,6 +1546,7 @@ pub fn main() -> Result<()> { statistics, file, range, + since, } => prepare_and_run( "blame", trace, @@ -1557,7 +1558,7 @@ pub fn main() -> Result<()> { core::repository::blame::blame_file( repository(Mode::Lenient)?, &file, - range, + gix::blame::Options { range, since }, out, statistics.then_some(err), ) diff --git a/src/plumbing/options/mod.rs b/src/plumbing/options/mod.rs index 8c7698052a0..70e80c56740 100644 --- a/src/plumbing/options/mod.rs +++ b/src/plumbing/options/mod.rs @@ -4,7 +4,7 @@ use clap_complete::Shell; use gitoxide_core as core; use gix::bstr::BString; -use crate::shared::AsRange; +use crate::shared::{AsRange, AsTime}; #[derive(Debug, clap::Parser)] #[clap(name = "gix", about = "The git underworld", version = option_env!("GIX_VERSION"))] @@ -167,6 +167,9 @@ pub enum Subcommands { /// Only blame lines in the given 1-based inclusive range ',', e.g. '20,40'. #[clap(short='L', value_parser=AsRange)] range: Option>, + /// Don't consider commits before the given date. + #[clap(long, value_parser=AsTime, value_name = "DATE")] + since: Option, }, /// Generate shell completions to stdout or a directory. #[clap(visible_alias = "generate-completions", visible_alias = "shell-completions")]