| 1 | t4220 diff-hunks test fixtures |
| 2 | ============================== |
| 3 | |
| 4 | trim-divergent-old, trim-divergent-new |
| 5 | -------------------------------------- |
| 6 | |
| 7 | Two revisions of a single real file, used by t4220-diff-hunks.sh to |
| 8 | exercise a "trim-divergent" blob pair: one whose diff hunk counts change |
| 9 | with the amount of context, so the trimmed and untrimmed results |
| 10 | disagree. |
| 11 | |
| 12 | They are two versions of git's own t/t6002-rev-list-bisect.sh, taken from |
| 13 | git.git history around: |
| 14 | |
| 15 | 090af9957c ("t6002: fix use of `expr` with `set -e`", |
| 16 | Patrick Steinhardt, 2026-04-21) |
| 17 | |
| 18 | which rewrites `$(expr ...)` arithmetic as `$((...))` and reformats a few |
| 19 | test_expect_success blocks. |
| 20 | |
| 21 | trim-divergent-old = 090af9957c^:t/t6002-rev-list-bisect.sh (blob daa009c9a1) |
| 22 | trim-divergent-new = 090af9957c :t/t6002-rev-list-bisect.sh (blob f2de40b5ed) |
| 23 | |
| 24 | To regenerate them from any git.git checkout: |
| 25 | |
| 26 | git show 090af9957c^:t/t6002-rev-list-bisect.sh >trim-divergent-old |
| 27 | git show 090af9957c:t/t6002-rev-list-bisect.sh >trim-divergent-new |
| 28 | |
| 29 | Why this pair |
| 30 | ------------- |
| 31 | |
| 32 | The diff-hunks store records only "trim-stable" pairs: those whose hunks |
| 33 | are identical whether or not xdiff trims the common head and tail (which |
| 34 | it does at zero context, in trim_common_tail). This pair is deliberately |
| 35 | NOT trim-stable: |
| 36 | |
| 37 | diff -U0 reports 9 added / 6 deleted |
| 38 | diff -U3 reports 10 added / 7 deleted |
| 39 | |
| 40 | Because the counts diverge with context, the writer must refuse to record |
| 41 | this pair and every command must recompute it from the blobs. t4220 uses |
| 42 | it to prove that the displayed counts stay correct at each context, and |
| 43 | that a divergent pair is never served from the store. See |
| 44 | t4220-diff-hunks.sh ("a trim-divergent file is correct at each context" |
| 45 | and the store-poison test). |
| 46 | |
| 47 | Why not a synthesized fixture |
| 48 | ----------------------------- |
| 49 | |
| 50 | The divergence needs real content that makes xdiff's common-tail trimming |
| 51 | shift a hunk boundary while the added/deleted balance stays equal. A |
| 52 | minimal hand-written file that reliably triggers the -U0 vs -U3 count |
| 53 | disagreement has not been found yet; until one is, this real pair is kept |
| 54 | verbatim. If you synthesize a smaller equivalent, replace these two files |
| 55 | and delete this note. |