GitoxideLabs/gitoxide · error

No commits to process

Error message

No commits to process

What it means

This error is thrown by the `hours` command (contributor activity histogram) in gitoxide-core when, after reading and filtering commits, no commits remain to process. The command cannot compute per-hour statistics from an empty set, so it aborts early with a bail! instead of producing empty output.

Solutions

  1. Verify the repository actually has commits (git log / gix log) before running the hours command
  2. Check the revision or range arguments resolve to at least one commit
  3. Remove author/date filters that exclude all commits
  4. Guard the caller: count commits first and skip the hours computation when the set is empty

Example fix

// before
gix hours --range nonexistent..main repo/
// after
git rev-list --count nonexistent..main  # confirm range has commits first
gix hours --range main repo/
Defensive patterns

Strategy: validation

Validate before calling

// Rust: ensure the commit set is non-empty before calling hours estimation
let commits: Vec<_> = collect_commits(repo, range)?;
if commits.is_empty() {
    eprintln!("Skipping hours analysis: no commits in range");
    return Ok(()); // or return a user-friendly error
}
hours::estimate(commits, /* ... */)?;

Try / catch

match hours::estimate(/* ... */) {
    Ok(result) => /* use result */,
    Err(e) if e.to_string().contains("No commits to process") => /* skip or report empty input */,
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling the `gix hours` CLI (gitoxide-core::hours::estimate) against a repository or commit range that yields zero commits - e.g. an empty repository, a revision range with no commits, or filters (authors/dates) excluding every commit.

Common situations: Running the hours analysis on a freshly initialized repo with no commits; specifying a branch or range that is empty; typos in revision arguments that resolve to nothing; passing date filters that exclude all commits.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/354ce4669aa42a77. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/hours/mod.rs:301

                    change_progress.show_throughput(start);
                    line_progress.show_throughput(start);
                    stats
                }
                None => Vec::new(),
            };

            Ok((
                extract_signatures.join().expect("no panic")?,
                stats_by_commit_idx,
                is_shallow,
                skipped_merge_commits,
                commit_idx,
            ))
        })?
    };

    if commit_authors.is_empty() {
        bail!("No commits to process");
    }

    let start = Instant::now();
    let mut current_email = &commit_authors[0].1.email;
    let mut slice_start = 0;
    let mut results_by_hours = Vec::new();
    let mut ignored_bot_commits = 0_u32;
    let mut push_estimate = |commits: &[(u32, SignatureRef<'static>)]| {
        let estimate = estimate_hours(commits, &stats);
        if ignore_bots && estimate.name.contains_str(b"[bot]") {
            ignored_bot_commits += estimate.num_commits;
            return;
        }
        results_by_hours.push(estimate);
    };
    for (idx, (_, elm)) in commit_authors.iter().enumerate() {
        if elm.email != *current_email {
            push_estimate(&commit_authors[slice_start..idx]);

View on GitHub (pinned to e73179060b)