Skip to content

No fixture exercises GNU root registration from the header pair (a fact line always supplies it first) #3925

Open

Description

@KuSh

A GNU diff -r stream teaches the parser which roots diff was given, so that a bare
(diffutils 3.10) Only in <dir>: <file> whose text holds more than one : splits at a
root the stream already named rather than at the first : .

Two places register those roots: the ---/+++ header pair (gnu_root_set.push under
if gnu_roots && !hg_stream) and the GNU fact arms (Binary files / Only in). Every
fixture that exercises this carries a fact line, so the header-pair registration is never
the one doing the work — and disabling it entirely fails no test.

Verified on develop (665b272) by removing the ! from the header-pair guard so the set
is never populated there, then running two inputs:

# shipped fixture — has "Binary files d: x/b.bin and e: y/b.bin differ" before the Only in
tests/fixtures/diff/diff_ru_310_colon_dirs_raw.txt
  correct : [file] e: y/only.txt (only in one side)
  patched : [file] e: y/only.txt (only in one side)   <- fact arm supplied the root

# same shape with no fact line, so only the header pair can name the root
diff -ru d: x/f.txt e: y/f.txt
--- d: x/f.txt	2026-09-07 13:03:55.284360030 +0000
+++ e: y/f.txt	2026-09-07 13:03:55.284360030 +0000
@@ -1 +1 @@
-a
+b
Only in e: y: only.txt

  correct : [file] e: y/only.txt (only in one side)
  patched : [file] e/y: only.txt (only in one side)   <- split at the first ": "

The second input is the missing fixture: a GNU echo, a header pair and a multi-:
Only in, with no Binary files / Files line ahead of it to supply the root. It is a
shape real diff -ru produces whenever the differing files under such a directory are all
text.

The behaviour is correct today; this is purely a hole in the corpus. Found while triaging
mutation-test survivors for #3923, which covers the other gaps that turned up.

Activity

  1. rtk-wshm-sync-bot commented on Sep 8, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟢 Priority low
    🎯 Confidence 70%

    Summary

    Test corpus lacks a fixture exercising GNU root registration via the header pair alone (no fact line ahead of the Only-in entry); add the missing fixture to close a coverage gap in the diff parser test suite.

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

    📁 Relevant files
    • tests/fixtures/diff/diff_ru_310_colon_dirs_raw.txt

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions