Skip to content

fix(git): no log cap notice under git's usage on git 2.56 - #4578

Merged
KuSh merged 1 commit into
developfrom
fix/git-log-usage-exit-zero
Oct 16, 2026
Merged

KuSh merged 1 commit into
developfrom
fix/git-log-usage-exit-zero

Conversation

@KuSh

@KuSh KuSh commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

git 2.56 answers -h with its usage and exit 0; earlier releases exited 129. rtk git log took an exit code of 128 or more to mean git refused the walk, so on 2.56 rtk git log -hp ran the cap probe after the usage text, the probe got the usage again and read it as commits left over, and [rtk] capped at 10 commits; pass -n <count> for more was appended under git's usage.

A -h flag, alone or in a cluster, now counts as a walk that never ran. Only a flag token counts: --grep -h and -- -h still run the walk and still get the notice.

This is what turns a_clustered_h_is_answered_by_git_once red on the macOS and Windows runners that moved to git 2.56 (2.55 jobs still pass), so open PRs fail or pass depending on which runner image they land on.

Test plan

  • New unit test a_short_h_asks_for_usage_but_a_value_or_pathspec_does_not; fails with the check disabled
  • a_clustered_h_is_answered_by_git_once run against git 2.56.0 (alpine:edge): fails without the change with the same output as CI, passes with it
  • cargo fmt --all --check, cargo clippy --all-targets, cargo test --all

🤖 Generated with Claude Code

git 2.56 answers `-h` with its usage and exit 0, where every earlier
release exited 129. `rtk git log` read "git refused the walk" from an
exit code of 128 or more, so on 2.56 `rtk git log -hp` ran the cap
probe after the usage text, the probe got the usage again, read it as
commits left over, and appended "[rtk] capped at 10 commits" under it.
`a_clustered_h_is_answered_by_git_once` fails this way on the macOS and
Windows runners that moved to git 2.56 (2.55 still passes).

A `-h` flag, alone or in a cluster, now counts as a walk that never ran.
Only a flag token does: `--grep -h` and `-- -h` still run the walk and
still get the notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working ci git labels Oct 15, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes rtk git log incorrectly appending a cap notice when running on git 2.56+, where -h now exits 0 with usage text instead of the previous non-zero exit code. The fix detects a -h flag token (not a flag value or pathspec) and treats it as a walk that never ran, suppressing the spurious notice.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

@aeppling aeppling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Verified against develop on git 2.55 and 2.56: the false cap notice under -h usage is gone, no true notice is lost, and stdout and exit codes are unchanged.

@KuSh
KuSh merged commit 16a20a2 into develop Oct 16, 2026
22 checks passed
@KuSh
KuSh deleted the fix/git-log-usage-exit-zero branch October 16, 2026 19:27
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci git

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants