Skip to content

rtk git log --oneline fails with argument parsing error #2

@FlorianBruniaux

Description

@FlorianBruniaux

Description

Git flags are not passed transparently to git, causing rtk git log --oneline and similar commands to fail.

Steps to Reproduce

$ rtk --version
rtk 0.2.0

$ rtk git log --oneline -20
error: unexpected argument '--oneline' found

Usage: rtk git log [OPTIONS]

Expected Behavior

$ rtk git log --oneline -20
# Should pass flags to git, then filter output
# Current workaround: rtk git log -- -20 (works)

Impact

CRITICAL: Blocks ALL common git flags:

  • --oneline (condensed log)
  • --graph (branch visualization)
  • --stat (diffstat)
  • --patch (show diff)
  • --all (all branches)

Affects every git user using RTK.

Root Cause

clap argument parser treats flags after rtk git log as RTK options instead of git passthrough.

Proposed Fix

// Current (WRONG)
#[derive(Parser)]
struct GitLogArgs {
    #[arg(short, long)]
    count: Option<usize>,
    // RTK parses git's flags
}

// Proposed (RIGHT)
#[derive(Parser)]
struct GitLogArgs {
    #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
    git_args: Vec<String>,
    // Pass everything to git, then filter output
}

Test Cases

After fix, these should all work:

rtk git log --oneline -20
rtk git log --graph --all
rtk git diff --stat HEAD~1
rtk git status --short
rtk git show --patch abc123

Environment

  • OS: macOS 14.6 (ARM64)
  • RTK: v0.2.0
  • Git: 2.43.0
  • Project: Production T3 Stack codebase (Next.js + tRPC + Prisma)

Additional Context

Discovered during real-world testing on production codebase. Workaround (-- separator) works but poor UX. This blocks adoption for users expecting standard git behavior.

Testing report: Available upon request (53KB benchmarks, 12 commands tested)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions