SIGN IN SIGN UP

fix(git): harden blob-show routing with a cluster-aware walker and per-candidate probe

The blob-show classifier still had a selection gap for short-flag CLUSTERS. git
re-parses a cluster's tail (`-wG x:y` == `-w -G x:y`), so `git show -wG x:y
HEAD:big` feeds `x:y` to -G and dumps only `HEAD:big`. But `show_positionals`
knew only single-letter value flags, so it kept `x:y` as the first positional; the
cat-file probe rejected it and the real blob fell through to the commit-diff path —
either dropping the windowing savings (large UTF-8 blob) or lossily decoding a Latin-1
blob into U+FFFD mojibake.

Two changes, neither of which mirrors git's flag grammar:

* Cluster-aware walker. `flag_token_consumes_next` extends the existing flag/value
  table to a short cluster's tail: the first value-taking short flag takes the rest of
  the cluster inline (`-Sfoo`) or, if it is the last char, the next token (`-wG x`).
  `is_short_value_flag` derives its char set FROM `consumes_next_token_as_value` so
  the table stays the single source of truth. (TODO points at #3681's ValueSpec.)

* Probe every candidate, keep any blob on the byte-safe path. `run_show` now
  cat-file-probes EVERY `rev:path` positional, not just the first, and takes the
  byte-safe path whenever ANY resolves to a blob — so even a walker miss can't misroute
  a blob's raw bytes through the lossy commit-diff decode. Windowing itself stays gated
  on a single sole positional, which also keeps `git show <commit> <rev:path>` (two
  real objects git concatenates) as byte-identical passthrough.

Also force byte-identical passthrough (never window) when a content-transforming flag
(--textconv/--filters/--ext-diff) or a trailing `-- <pathspec>` is present: the
`git show rev:path | tail` recovery hint omits them, so windowing could not reconstruct
git's bytes exactly. Narrows the fidelity-invariant comment accordingly.

`blob_show_target` (first-positional-only) is replaced by `blob_candidates` (all
candidates); unit tests migrated and extended to cover the cluster shapes.
B
breisnerlopez committed
67e47294d941c1c338cd5efa0fe58523779ed3c2
Parent: dae3b29