@@ -381,7 +381,18 @@ fn test_git_priority_boost_with_path_prefix() -> Result<(), Box<dyn std::error::
381
381
let temp = TempDir :: new ( ) ?;
382
382
setup_git_repo ( temp. path ( ) ) ?;
383
383
384
- // Create test files with different dates and in different paths
384
+ // We'll give src/module2/recent.rs a commit date that is 1 second newer
385
+ // so that it definitely has a higher priority than docs/recent.md.
386
+ let now = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) ?. as_secs ( ) ;
387
+ // For docs:
388
+ let docs_date = chrono:: DateTime :: from_timestamp ( ( now as i64 ) - 1 , 0 )
389
+ . unwrap ( )
390
+ . to_rfc3339 ( ) ;
391
+ // For src:
392
+ let src_date = chrono:: DateTime :: from_timestamp ( now as i64 , 0 )
393
+ . unwrap ( )
394
+ . to_rfc3339 ( ) ;
395
+
385
396
fs:: create_dir_all ( temp. path ( ) . join ( "src/module1" ) ) ?;
386
397
fs:: create_dir_all ( temp. path ( ) . join ( "src/module2" ) ) ?;
387
398
fs:: create_dir_all ( temp. path ( ) . join ( "docs" ) ) ?;
@@ -394,20 +405,16 @@ fn test_git_priority_boost_with_path_prefix() -> Result<(), Box<dyn std::error::
394
405
"2023-01-01T12:00:00+00:00" ,
395
406
) ?;
396
407
397
- // Create files in src/module2
398
- let now = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) ?. as_secs ( ) ;
399
- let recent_date = chrono:: DateTime :: from_timestamp ( now as i64 , 0 )
400
- . unwrap ( )
401
- . to_rfc3339 ( ) ;
408
+ // Create files in src/module2 with newer timestamp
402
409
commit_file (
403
410
temp. path ( ) ,
404
411
"src/module2/recent.rs" ,
405
412
"recent content" ,
406
- & recent_date ,
413
+ & src_date ,
407
414
) ?;
408
415
409
- // Create files in docs
410
- commit_file ( temp. path ( ) , "docs/recent.md" , "recent docs" , & recent_date ) ?;
416
+ // Create files in docs with slightly older timestamp
417
+ commit_file ( temp. path ( ) , "docs/recent.md" , "recent docs" , & docs_date ) ?;
411
418
412
419
// Create config with priority rules
413
420
let config = YekConfig {
0 commit comments