mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
27abf4ad7f
Review round 7 asked for two things; a producer enumeration and two
adversarial review passes answered for thirty. Every item below has a
real capture in the corpus (81 fixtures now: git 2.47/2.54, diffutils
3.10 and 3.12, Mercurial 7.0, Subversion 1.14, PowerShell) and a test
that fails without the fix.
Silent loss (a file or content line missing while the output looked
complete) -- each now returns `None`, byte-exact raw passthrough:
- GNU sorts its output, so a fact the parser cannot read (`File X is a
fifo ...`, `Symbolic links ... differ`, a translated `Only in`) can
come before the first `Only in` / `Binary files` / `Files` line, and
`-q` streams carry no echo at all. The latch is now `dropped_line` --
any column-0 line dropped as prose outside a message region -- and is
judged once after the loop against `gnu_stream`, which GNU's fact arms
set as well as its echo (hg's echo does not: an `hg log -p --template`
prologue is prose, not a fact).
- `hg export`'s region stayed open until the first header pair and
swallowed `Binary file bin.dat has changed` on a binary-first
changeset. hg's `diff -r` echo (one `-r` from `hg diff`, two from
`hg export` / `hg log -p`) now closes the region, counts as reaching
its body, and the line is a binary fact; rule 6 stays live inside an
hg region. `hg log -p`'s `changeset:` line opens the region like
`# HG changeset patch` does.
- `git diff --word-diff` / `--color-words` hunks whose lines are all
indented carry their `[-x-]{+y+}` markers behind the indent, so the
hunk was booked as context and the file vanished. A hunk that closes
with no `-`/`+` line is not a unified-diff shape (whitespace-ignoring
modes suppress the hunk) -> `None`.
- `git format-patch --submodule=log` puts `Submodule sub a..b:` where a
file section would go, inside the message region where rule 6 is
suppressed. The strict `<hex>..<hex>[ (<how>)]:` shape is admitted
there (`is_submodule_range`); prose never ends a line that way.
- A stream cut off right after `diff --git` / `index` dropped the file
it named: git never emits a header-only section, so one that closes
with nothing behind it -> `None` (`FileEntry::from_git`; `flush`
returns `Option`). git's `index` / `similarity index` lines are
structural and no longer count as dropped prose.
- A plain `svn diff` names a binary only as `Index: b.dat` + `Cannot
display: file marked as a binary type.`, both prose before: the
binary vanished beside its text siblings. `Index: <path>` opens a
section (rule 3c); the notice is its binary note; an `Index:` section
that closes empty is `(no content)` (a copy/move target) unless a
column-0 line was dropped inside it (a localized notice) -> `None`.
- A binary section followed by another producer's header pair was
renamed in place and its `binary` note landed on the next file; a
pair after a binary section opens its own section.
A crash: the shared-tail scan behind `diff --git X Y` and `Binary files
X and Y` compared bytes, and two different multi-byte characters can
share trailing bytes (`😀`/`🙀`, `é`/`©`): the slice landed mid-character
and the process aborted with no output at all. The scan backs off to a
character boundary on both sides.
Names, byte-equal to the real filename under the producer's own root:
- `dequote` decodes git's C quoting (`"caf\303\251.txt"` -> `café.txt`)
instead of stripping the wrapper; a name that would split a `[file]`
line (newline) or is not UTF-8 keeps git's own quoted spelling, with
the prefix stripped inside the quotes, so `rename to`, `diff --cc` and
the header pair agree on one spelling and two Latin-1 names stay two.
- `unquote_shell` decodes diffutils >= 3.11's shell quoting on `Only in`
/ `Binary files` names -- `'…'`, `$'…'` and the `"…"` form it picks
for a name holding a `'`; a quoted directory may itself hold `: `, so
the `Only in` split follows the quoting (`shell_word_len`). 3.10
prints those names bare; a bare `Only in` with more than one `: `
splits at the root the stream already named on its echo, header pairs
or `Binary files` lines. Both generations are in the corpus.
- `diff --git X Y` is split where the sides share the longest tail at a
`/` boundary (`shared_tail`); the first path component before the
tail on each side is that side's prefix (`FileEntry::prefixes`
replaces `prefixed`): `a/`/`b/`, `i/`/`w/` under
`diff.mnemonicPrefix`, `--src-prefix`/`--dst-prefix`, none under
`--no-prefix`. The header pair strips exactly those, so `* Unmerged
path b/inb.txt` folds into its `i/b/inb.txt w/b/inb.txt` section, a
binary under a directory named `x b/` keeps its path, and `git diff
--no-index d1/f d2/f` names `d2/f`. `diff --cc <path>` is kept whole;
`--no-index --no-prefix x.bin y.bin` names `y.bin`.
- GNU diff names files under the roots it was given, never prefixes:
header pairs after a GNU echo and the standalone `Binary files` /
`Files` arms keep them (`diff -ru a b` -> `b/c.txt`, `diff -ru .
../new` -> `../new/x`), splitting `X and Y` by the same shared tail.
- Timestamps are stripped from `---`/`+++` lines only, at the LAST tab
and only when shaped like one of the real producers' (GNU ISO date,
hg `Mon Sep 07 …`, svn `(revision 1)`, git's bare tab), so a name
containing a tab survives even under `hg diff --nodates`.
- An `* Unmerged path` fact git printed unquoted and cut at a newline
folds into its quoted section instead of a phantom entry.
Spurious raw fallbacks on well-formed streams, now condensed: `git log
--stat -p` / `git show --stat -p` (bare `---` followed by a diffstat
line is the separator -- which also drops the old ` name | 3` bound),
`git log --numstat -p` (`-<TAB>-<TAB>` binary rows), `hg log -p` with
and without `--template`, an hg binary-only changeset whose message has
a marked non-prose line, `--format=%B` prose starting with `diff ` (the
GNU echo arm keys on `diff -`), `diff -u` on directories (`Common
subdirectories:` dropped), an svn copy/move target.
Also: GNU `-s` / `-q` facts are entries; a PowerShell-written stream's
UTF-8 BOM is stripped; a submodule both dirty and moved is one entry;
the budget replay in property (a) asserts under-consumption; the docs
list rule 1b and every bound is executable in `documented_bounds_hold`.
90 lines
1.6 KiB
Plaintext
90 lines
1.6 KiB
Plaintext
diff --cc b/blob.bin
|
|
index d6db588,a903574..0000000
|
|
Binary files differ
|
|
diff --cc b/inb.txt
|
|
index ba2906d,2299c37..0000000
|
|
--- a/b/inb.txt
|
|
+++ b/b/inb.txt
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc "caf\303\251.txt"
|
|
index ba2906d,2299c37..0000000
|
|
--- "a/caf\303\251.txt"
|
|
+++ "b/caf\303\251.txt"
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc "caf\303\251.txt.bin"
|
|
index d6db588,a903574..0000000
|
|
Binary files differ
|
|
diff --cc colon: x.txt
|
|
index ba2906d,2299c37..0000000
|
|
--- a/colon: x.txt
|
|
+++ b/colon: x.txt
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc d: x/f.txt
|
|
index ba2906d,2299c37..0000000
|
|
--- a/d: x/f.txt
|
|
+++ b/d: x/f.txt
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc "new\nline.txt"
|
|
index ba2906d,2299c37..0000000
|
|
--- "a/new\nline.txt"
|
|
+++ "b/new\nline.txt"
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc "say \"hi\".txt"
|
|
index ba2906d,2299c37..0000000
|
|
--- "a/say \"hi\".txt"
|
|
+++ "b/say \"hi\".txt"
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc "say \"hi\".txt.bin"
|
|
index d6db588,a903574..0000000
|
|
Binary files differ
|
|
diff --cc "tab\there.txt"
|
|
index ba2906d,2299c37..0000000
|
|
--- "a/tab\there.txt"
|
|
+++ "b/tab\there.txt"
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|
|
diff --cc trail .txt
|
|
index ba2906d,2299c37..0000000
|
|
--- a/trail .txt
|
|
+++ b/trail .txt
|
|
@@@ -1,1 -1,1 +1,5 @@@
|
|
++<<<<<<< HEAD
|
|
+main
|
|
++=======
|
|
+ side
|
|
++>>>>>>> side
|