@@ -2577,6 +2577,39 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
25772577 } ) ,
25782578 ) ;
25792579
2580+ it . effect ( "reads range patches from source without running textconv" , ( ) =>
2581+ Effect . gen ( function * ( ) {
2582+ const cwd = yield * makeTmpDir ( ) ;
2583+ const { initialBranch } = yield * initRepoWithCommit ( cwd ) ;
2584+ yield * git ( cwd , [ "config" , "diff.probe.textconv" , "touch textconv-ran; echo converted" ] ) ;
2585+ yield * git ( cwd , [ "checkout" , "-b" , "feature/range" ] ) ;
2586+ yield * writeTextFile ( cwd , ".gitattributes" , "*.doc diff=probe\n" ) ;
2587+ yield * writeTextFile ( cwd , "notes.doc" , "source line\n" ) ;
2588+ yield * writeTextFile ( cwd , "plain.txt" , "plain line\n" ) ;
2589+ yield * writeTextFile ( cwd , "binary.dat" , "binary\0data" ) ;
2590+ yield * git ( cwd , [ "add" , "." ] ) ;
2591+ yield * git ( cwd , [ "commit" , "-m" , "range files" ] ) ;
2592+ const driver = yield * GitVcsDriver . GitVcsDriver ;
2593+ const fileSystem = yield * FileSystem . FileSystem ;
2594+
2595+ const context = yield * driver . readRangeContext ( cwd , initialBranch ) ;
2596+
2597+ assert . include ( context . diffPatch , "+source line" ) ;
2598+ assert . notInclude ( context . diffPatch , "converted" ) ;
2599+ assert . include ( context . diffPatch , "+plain line" ) ;
2600+ assert . include ( context . diffPatch , "Binary files /dev/null and b/binary.dat differ" ) ;
2601+ assert . include ( context . diffSummary , "notes.doc" ) ;
2602+ assert . isFalse ( yield * fileSystem . exists ( `${ cwd } /textconv-ran` ) ) ;
2603+
2604+ yield * writeTextFile ( cwd , "notes.doc" , "updated source line\n" ) ;
2605+ const staged = yield * driver . prepareCommitContext ( cwd , [ "notes.doc" ] ) ;
2606+ assert . include ( staged ?. stagedPatch ?? "" , "+updated source line" ) ;
2607+ assert . notInclude ( staged ?. stagedPatch ?? "" , "converted" ) ;
2608+ assert . include ( staged ?. stagedSummary ?? "" , "notes.doc" ) ;
2609+ assert . isFalse ( yield * fileSystem . exists ( `${ cwd } /textconv-ran` ) ) ;
2610+ } ) ,
2611+ ) ;
2612+
25802613 it . effect ( "loads new and deleted files without reading their missing side" , ( ) =>
25812614 Effect . gen ( function * ( ) {
25822615 const cwd = yield * makeTmpDir ( ) ;
0 commit comments