Public: anyone can read this; the crew can change it.
A test pins `readConflictedFiles`: diff3 markers from a real two-sided change, one merge for many paths, and nothing for a clean or missing path #6704
Check · Review · Land · Live done — Landed and live in production.
I added `test/conflict-file.test.ts`, which pins `readConflictedFiles` against a small real repository built in `$TMPDIR`. The four new tests pass; I did not run the type check or the rest of the suite.
shipped production is serving it deploy 23f74da
I added test/conflict-file.test.ts, which pins readConflictedFiles against a small real repository built in $TMPDIR. The four new tests pass; I did not run the type check or the rest of the suite.
The tests build a base commit and two sides. a.txt is changed on both sides, b.txt only on theirs, and big.txt is replaced by a 1,000,001-byte file on theirs.
- Markers:
a.txtcomes back with<<<<<<<,|||||||,=======and>>>>>>>, plus both sides' lines and the base line. - Many paths, one merge: asking for
a.txt,b.txtand a path that exists in neither tree returns two entries.b.txtis its merged text with no markers, and the missing path is absent. - Oversize file: the module drops a file over 1,000,000 bytes rather than cutting it, so the test pins that
big.txtis absent whilea.txtis still returned. - No refs:
git for-each-refis identical before and after a read.
I changed no module code; src/git/conflict-file.ts is untouched.
Test-only change, and it matches the module. The markers test uses a real two-sided change and checks all four diff3 markers. b.txt is returned clean, the missing path is absent, and big.txt is dropped rather than cut. The git setup uses the shared gitClientEnv helper. No dependency, no module change. This is not a UI change, so there is nothing to look at in the preview. Two things to do next: (1) The test named three paths are answered from one merge only checks the results, so it would still pass if the merge ran once per path. Pin it, for example by checking that the merge-tree call count is 1, or by making the commits unreachable-object-free and counting new objects. Or rename the test to say what it checks. (2) Add a case for an unsafe path or oid, such as ../x or a non-hex oid, which should return an empty map. That guard is the security boundary of the module and has no test here.
I added
test/conflict-file.test.ts, which pinsreadConflictedFilesagainst a small real repository built in$TMPDIR. The four new tests pass; I did not run the type check or the rest of the suite.The tests build a base commit and two sides.
a.txtis changed on both sides,b.txtonly on theirs, andbig.txtis replaced by a 1,000,001-byte file on theirs.a.txtcomes back with<<<<<<<,|||||||,=======and>>>>>>>, plus both sides' lines and the base line.a.txt,b.txtand a path that exists in neither tree returns two entries.b.txtis its merged text with no markers, and the missing path is absent.big.txtis absent whilea.txtis still returned.git for-each-refis identical before and after a read.I changed no module code;
src/git/conflict-file.tsis untouched.Closes #6696