fix(git): include the oldest selected commit in ranges
What & why
The Changes tab highlights both selected commits, but the host used the older selected commit as an exclusive diff base. This left that commit's files and changes out of the list and diff.
This adds an optional includeFrom input. The host resolves the parent of the selected starting commit, or the empty tree for a root commit. Existing callers keep the current fromHash behavior. The flag reaches the file list, single-file diff, bulk diff, patch diff, and binary-side paths.
Closes #9234
How I tested it
bun test test/integration/git-history.integration.test.tsfrompackages/host-service: 8 passed, including the oldest-commit and root-commit cases.bun run typecheckfrompackages/host-service: passed.bun run typecheckfromapps/desktop: passed.- Biome check on all 11 changed source and test files: passed.
bun run lintcould not start on this Windows host becausescripts/lint.shrequires Bash. The direct Biome check passed.- No CDP screenshot was captured.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
- I have signed the CLA (the bot asks on your first PR)
Summary by cubic
Fixes commit range diffs in the Changes tab so the oldest selected commit is actually included in the file list and diff.
Previously, range diffs used the older selected commit as an exclusive base, so that commit's own changes never appeared. This adds an optional includeFrom flag that, when set, resolves the parent of the selected starting commit (or the empty tree for a root commit) as the diff base instead. Existing callers without the flag keep the current behavior.
- Propagates
includeFromthrough the file list, single-file diff, bulk diff, patch diff, and binary-side paths. - Adds integration tests covering an inclusive 3-commit range and a root commit as the range start.
Summary by CodeRabbit
- New Features
- Commit-range comparisons can now include the starting commit, so changes from the full selected range appear in file lists and diffs.
- Inclusive ranges that start at a repository’s first commit are also supported.