@@ -276,7 +276,13 @@ for (const nested of [false, true]) {
276276}
277277
278278for ( const sparseIndex of [ false , true ] ) {
279- for ( const indexState of [ "normal" , "assumed" , "missing" , "invalid" ] as const ) {
279+ for ( const indexState of [
280+ "normal" ,
281+ "assumed" ,
282+ "assumed-deleted" ,
283+ "missing" ,
284+ "invalid" ,
285+ ] as const ) {
280286 it . effect (
281287 `checkpoint capture preserves sparse files (sparseIndex=${ sparseIndex } , index=${ indexState } )` ,
282288 ( ) =>
@@ -290,7 +296,7 @@ for (const sparseIndex of [false, true]) {
290296 const { git, checkpointRef } = yield * makeCheckpointFixture ( driver , cwd ) ;
291297 const write = ( name : string , contents : string ) =>
292298 fileSystem . writeFileString ( path . join ( cwd , name ) , contents ) ;
293- for ( const directory of [ "included" , "excluded" ] ) {
299+ for ( const directory of [ "included" , "included/empty" , " excluded"] ) {
294300 yield * fileSystem . makeDirectory ( path . join ( cwd , directory ) ) ;
295301 yield * write ( `${ directory } /tracked` , "original\n" ) ;
296302 }
@@ -299,13 +305,25 @@ for (const sparseIndex of [false, true]) {
299305 yield * git ( [ "commit" , "-m" , "sparse fixture" ] ) ;
300306 yield * git ( [
301307 "sparse-checkout" ,
302- "set " ,
308+ "init " ,
303309 "--cone" ,
304310 sparseIndex ? "--sparse-index" : "--no-sparse-index" ,
305- "included" ,
306311 ] ) ;
312+ yield * git ( [ "sparse-checkout" , "set" , "included" ] ) ;
307313 if ( indexState === "assumed" ) {
314+ yield * git ( [ "config" , "core.trustctime" , "false" ] ) ;
315+ yield * fileSystem . utimes (
316+ path . join ( cwd , "included/tracked" ) ,
317+ 1_700_000_000 ,
318+ 1_700_000_000 ,
319+ ) ;
320+ yield * git ( [ "add" , "included/tracked" ] ) ;
321+ }
322+ if ( indexState === "assumed" || indexState === "assumed-deleted" ) {
308323 yield * git ( [ "update-index" , "--assume-unchanged" , "included/tracked" ] ) ;
324+ if ( indexState === "assumed-deleted" ) {
325+ yield * git ( [ "update-index" , "--assume-unchanged" , "included/deleted" ] ) ;
326+ }
309327 } else {
310328 yield * write ( "included/tracked" , "staged\n" ) ;
311329 yield * git ( [ "add" , "included/tracked" ] ) ;
@@ -314,11 +332,24 @@ for (const sparseIndex of [false, true]) {
314332 if ( indexState === "missing" ) yield * fileSystem . remove ( indexPath ) ;
315333 if ( indexState === "invalid" )
316334 yield * fileSystem . writeFileString ( indexPath , "invalid index" ) ;
335+ if ( indexState === "assumed" ) {
336+ yield * fileSystem . utimes ( indexPath , 1_700_000_000 , 1_700_000_000 ) ;
337+ }
317338 const originalIndex = yield * fileSystem
318339 . readFile ( indexPath )
319340 . pipe ( Effect . orElseSucceed ( ( ) => null ) ) ;
320- yield * write ( "included/tracked" , "working\n" ) ;
321- yield * fileSystem . remove ( path . join ( cwd , "included/deleted" ) ) ;
341+ yield * write ( "included/tracked" , "modified\n" ) ;
342+ if ( indexState === "assumed" ) {
343+ yield * fileSystem . utimes (
344+ path . join ( cwd , "included/tracked" ) ,
345+ 1_700_000_000 ,
346+ 1_700_000_000 ,
347+ ) ;
348+ }
349+ if ( indexState !== "assumed" ) {
350+ yield * fileSystem . remove ( path . join ( cwd , "included/deleted" ) ) ;
351+ yield * fileSystem . remove ( path . join ( cwd , "included/empty" ) , { recursive : true } ) ;
352+ }
322353 yield * write ( "included/new" , "new\n" ) ;
323354 yield * fileSystem . makeDirectory ( path . join ( cwd , "excluded" ) , { recursive : true } ) ;
324355 yield * write ( "excluded/artifact" , "artifact\n" ) ;
@@ -327,7 +358,7 @@ for (const sparseIndex of [false, true]) {
327358
328359 assert . strictEqual (
329360 ( yield * git ( [ "show" , `${ checkpointRef } :included/tracked` ] ) ) . stdout ,
330- "working \n" ,
361+ "modified \n" ,
331362 ) ;
332363 assert . strictEqual (
333364 ( yield * git ( [ "show" , `${ checkpointRef } :included/new` ] ) ) . stdout ,
@@ -341,9 +372,17 @@ for (const sparseIndex of [false, true]) {
341372 ( yield * git ( [ "show" , `${ checkpointRef } :excluded/artifact` ] ) ) . stdout ,
342373 "artifact\n" ,
343374 ) ;
344- assert . notInclude (
345- ( yield * git ( [ "ls-tree" , "-r" , "--name-only" , checkpointRef ] ) ) . stdout ,
346- "included/deleted" ,
375+ assert . strictEqual (
376+ ( yield * git ( [ "ls-tree" , "-r" , "--name-only" , checkpointRef ] ) ) . stdout . includes (
377+ "included/deleted" ,
378+ ) ,
379+ indexState === "assumed" ,
380+ ) ;
381+ assert . strictEqual (
382+ ( yield * git ( [ "ls-tree" , "-r" , "--name-only" , checkpointRef ] ) ) . stdout . includes (
383+ "included/empty/tracked" ,
384+ ) ,
385+ indexState === "assumed" ,
347386 ) ;
348387 assert . isFalse ( yield * fileSystem . exists ( path . join ( cwd , "excluded/tracked" ) ) ) ;
349388 assert . deepEqual (
0 commit comments