walk_commits_from

Function walk_commits_from 

Source
pub fn walk_commits_from(
    start_commit: &str,
    num_commits: usize,
) -> Result<Vec<CommitWithNotes>>
Expand description

Retrieves raw git notes data for commits starting from a specific commit.

This function performs a low-level git log operation to extract commit hashes and their associated raw note lines from the performance notes ref. It updates the local read branch, resolves the starting commit, and traverses up to num_commits following the first-parent ancestry chain.

§Arguments

  • start_commit - The committish reference to start walking from (e.g., “HEAD”, “main”, commit hash)
  • num_commits - Maximum number of commits to retrieve

§Returns

Returns a vector of CommitWithNotes, where each entry contains:

  • The commit SHA-1 hash
  • The commit title (subject line)
  • The commit author name
  • A vector of raw note lines associated with that commit

§Errors

Returns an error if:

  • The starting commit cannot be resolved or does not exist
  • Git log operation fails
  • The repository is a shallow clone (issues a warning but may still succeed)
  • Git log output format is invalid

§Warnings

If a shallow clone is detected (grafted commits), a warning is issued as this may result in incomplete history traversal.

§Examples

let commits = walk_commits_from("HEAD", 5).unwrap();
for commit in commits {
    println!("Commit: {} by {}: {}", commit.sha, commit.author, commit.title);
}