@@ -3984,6 +3984,29 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
39843984 } ) ;
39853985
39863986 describe ( "commit context" , ( ) => {
3987+ it . effect ( "can omit the patch while preserving change detection and the real index" , ( ) =>
3988+ Effect . gen ( function * ( ) {
3989+ const cwd = yield * makeTmpDir ( ) ;
3990+ yield * initRepoWithCommit ( cwd ) ;
3991+ const driver = yield * GitVcsDriver . GitVcsDriver ;
3992+ assert . isNull ( yield * driver . prepareCommitContext ( cwd , undefined , { includePatch : false } ) ) ;
3993+ yield * writeTextFile ( cwd , "selected.txt" , "selected content\n" ) ;
3994+ yield * writeTextFile ( cwd , "other.txt" , "other content\n" ) ;
3995+ yield * git ( cwd , [ "add" , "other.txt" ] ) ;
3996+ const before = yield * git ( cwd , [ "diff" , "--cached" ] ) ;
3997+ const summaryOnly = yield * driver . prepareCommitContext ( cwd , [ "selected.txt" ] , {
3998+ includePatch : false ,
3999+ } ) ;
4000+ assert . include ( summaryOnly ?. stagedSummary ?? "" , "selected.txt" ) ;
4001+ assert . notInclude ( summaryOnly ?. stagedSummary ?? "" , "other.txt" ) ;
4002+ assert . equal ( summaryOnly ?. stagedPatch , "" ) ;
4003+ const full = yield * driver . prepareCommitContext ( cwd , [ "selected.txt" ] ) ;
4004+ assert . equal ( full ?. stagedSummary , summaryOnly ?. stagedSummary ) ;
4005+ assert . include ( full ?. stagedPatch ?? "" , "+selected content" ) ;
4006+ assert . equal ( yield * git ( cwd , [ "diff" , "--cached" ] ) , before ) ;
4007+ } ) ,
4008+ ) ;
4009+
39874010 it . effect ( "prepares selected files without staging and commits only those files" , ( ) =>
39884011 Effect . gen ( function * ( ) {
39894012 const cwd = yield * makeTmpDir ( ) ;
0 commit comments