Skip to content

git log -n<N> combined form silently truncated to 10 commits #2665

Closed

Description

@guyoron1

Description

rtk git log -n20 silently truncates output to 10 commits instead of 20. The combined -n<N> form (e.g. -n20, -n5) is not recognized by either the has_limit_flag detection or parse_user_limit().

Steps to Reproduce

rtk git log -n20    # shows 10 commits instead of 20
rtk git log -n 20   # works correctly (shows 20)
rtk git log -20     # works correctly (shows 20)

Root Cause

In src/cmds/git/git.rs, the has_limit_flag check only detects:

  • -<digit> (like -20)
  • -n as a standalone token (for the -n 20 two-token form)
  • --max-count prefix

It does not detect -n<digits> (e.g. -n20), which is a valid and commonly used git syntax.

When -n20 is not detected as a limit flag:

  1. RTK injects its own -10 limit → git uses the last limit (-n20) and outputs 20 commits
  2. RTK sets limit = 10 and user_set_limit = false in filter_log_output()
  3. The filter truncates to 10 commits → user loses half their requested output

The same gap exists in parse_user_limit(), which also doesn't handle the -n<N> combined form.

Expected Behavior

rtk git log -n20 should show 20 commits, identical to rtk git log -n 20 and rtk git log -20.

Activity

  1. added
    bug
    good first issue
    on Jun 27, 2026
  2. pszymkowiak commented on Jun 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 97%

    Summary

    The combined -n<N> git flag form (e.g. -n20) is not recognized by has_limit_flag or parse_user_limit(), causing RTK to silently inject its own -10 limit and truncate output; fix is to add a -n\d+ pattern match in both functions in src/cmds/git/git.rs.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/cmds/git/git.rs

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

  3. added 2 commits that reference this issue on Aug 8, 2026
    c402a05
    4763e3e
  4. added a commit that references this issue on Aug 14, 2026
    4053395
  5. added a commit that references this issue on Sep 14, 2026
    6f36f47
  6. guyoron1 commented on Sep 21, 2026

    @guyoron1
    ContributorAuthor

    Fixed on develop by the shared arg tokenizer in #3681: rtk git log -n20 now returns 20 commits (it returned 10 before that). #2666 is now a tests-only PR that pins the glued -n<N> form. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibuggood first issuepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions