rtk-ai/rtk

`rtk git branch -vv` strips commit hashes, tracking markers, and remote metadata — filter has no `-vv` awareness

Open

#1499 opened on Apr 24, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Rust (48,085 stars) (2,914 forks)batch import
bugeffort-smallfilter-qualitygood first issue

Description

rtk git branch -vv drops commit hashes, the [origin/...] upstream tracking marker, and commit subjects — the very information -vv exists to show. filter_branch_output is designed around bare git branch -a output and has no handling for the verbose format, so metadata the user explicitly requested is silently discarded.

Reproduction

$ RTK_DISABLED=1 git branch -vv
  feature-a  abc12345 Some commit subject
  feature-b  def67890 Another commit subject
* main       12345678 [origin/main] Latest commit on main

$ rtk git branch -vv
* main
  feature-a
  feature-b
  remote-only (3):
    topic-x
    agent/topic-y-abc123
    topic-z

The upstream marker [origin/main], the commit hashes, and the subjects are gone. From the agent's point of view, git branch -vv is indistinguishable from git branch -a — the flag had no effect.

Cause

-vv isn't in the list-flag set at run_branch, so the command falls through to List mode:

https://github.com/rtk-ai/rtk/blob/80a6fe606f73b19e52b0b330d242e62a6c07be42/src/cmds/git/git.rs#L1144-L1164

List mode adds -a --no-color, passes -vv through to git, then pipes the result through filter_branch_output:

https://github.com/rtk-ai/rtk/blob/80a6fe606f73b19e52b0b330d242e62a6c07be42/src/cmds/git/git.rs#L1234-L1261

filter_branch_output was designed for bare git branch -a output (see the test fixtures at lines 1885-1925 — none use -vv format) and reshapes everything into the compact * current + locals + remote-only block shown above. There's no code path that preserves [origin/...] markers or hash + subject when -vv is present:

https://github.com/rtk-ai/rtk/blob/80a6fe606f73b19e52b0b330d242e62a6c07be42/src/cmds/git/git.rs#L1273-L1328

Impact

-vv is the canonical way to check upstream tracking state — "does my local branch have an upstream? is it ahead/behind?". When RTK answers the agent's git branch -vv with bare names, the agent has no way to see tracking configuration and may conclude branches have no upstream when they do. RTK_DISABLED=1 git branch -vv works as a workaround, but as with #1474 and #730, the agent only reaches for it once something else tips it off that the output is incomplete.

Suggestion

The project's own design philosophy covers this case:

When a user or LLM explicitly requests detailed output via flags (e.g., git log --comments, cargo test -- --nocapture, ls -la), respect that intent. Compressing explicitly-requested detail defeats the purpose.

-v / -vv / --verbose fit that rule exactly. One option is to detect those flags in run_branch and passthrough raw. Another is to make filter_branch_output aware of the verbose format and preserve the hash + tracking marker + subject per line. Passthrough is simpler and matches the principle more literally.

Broader Pattern

Same class of bug as #1474, #730, #720 — a filter that isn't flag-aware silently strips content the user asked for, and the hook makes the loss invisible to the agent.

Related

  • #1474 — gh pr comment --help outputs canned ok commented (same class: flag ignored)
  • #730 — gh pr diff --name-only returns empty (same class: filter applied to non-matching data)
  • #720 — --comments silently dropped on gh issue/pr view (same class: flag ignored)

Environment

  • rtk 0.37.2
  • Windows 11 (Git Bash)

Contributor guide