get_commits_in_time_range

Function get_commits_in_time_range 

Source
pub fn get_commits_in_time_range(
    repo_path: &Path,
    after: DateTime<Utc>,
    before: DateTime<Utc>,
) -> Result<Vec<CommitInfo>>
Expand description

Retrieves all commits in a repository made within a time range.

Walks the commit history from all local branches and collects all commits whose timestamps fall between after and before (inclusive on both ends). Commits are returned in reverse chronological order (newest first).

This is equivalent to git log --all --after=X --before=Y.

This is used for auto-linking sessions to commits made during the session’s time window.

§Arguments

  • repo_path - A path inside the git repository
  • after - Only include commits at or after this time
  • before - Only include commits at or before this time

§Errors

Returns an error if the repository cannot be found or the commit history cannot be walked.