@@ -276,7 +276,9 @@ impl AsyncLog {
276
276
let mut entries = vec ! [ CommitId :: default ( ) ; LIMIT_COUNT ] ;
277
277
entries. resize ( 0 , CommitId :: default ( ) ) ;
278
278
279
- let mut repo = gix:: open ( repo_path. gitpath ( ) ) ?;
279
+ let mut repo: gix:: Repository =
280
+ gix:: ThreadSafeRepository :: discover_with_environment_overrides ( repo_path. gitpath ( ) )
281
+ . map ( Into :: into) ?;
280
282
let mut walker =
281
283
LogWalkerWithoutFilter :: new ( & mut repo, LIMIT_COUNT ) ?;
282
284
@@ -321,3 +323,49 @@ impl AsyncLog {
321
323
. expect ( "error sending" ) ;
322
324
}
323
325
}
326
+
327
+ #[ cfg( test) ]
328
+ mod tests {
329
+ use std:: sync:: atomic:: AtomicBool ;
330
+ use std:: sync:: { Arc , Mutex } ;
331
+ use std:: time:: Duration ;
332
+
333
+ use crossbeam_channel:: unbounded;
334
+
335
+ use crate :: sync:: tests:: { debug_cmd_print, repo_init} ;
336
+ use crate :: sync:: RepoPath ;
337
+ use crate :: AsyncLog ;
338
+
339
+ use super :: AsyncLogResult ;
340
+
341
+ #[ test]
342
+ fn test_smoke_in_subdir ( ) {
343
+ let ( _td, repo) = repo_init ( ) . unwrap ( ) ;
344
+ let root = repo. path ( ) . parent ( ) . unwrap ( ) ;
345
+ let repo_path: RepoPath =
346
+ root. as_os_str ( ) . to_str ( ) . unwrap ( ) . into ( ) ;
347
+
348
+ let ( tx_git, _rx_git) = unbounded ( ) ;
349
+
350
+ debug_cmd_print ( & repo_path, "mkdir subdir" ) ;
351
+
352
+ let subdir = repo. path ( ) . parent ( ) . unwrap ( ) . join ( "subdir" ) ;
353
+ let subdir_path: RepoPath =
354
+ subdir. as_os_str ( ) . to_str ( ) . unwrap ( ) . into ( ) ;
355
+
356
+ let arc_current = Arc :: new ( Mutex :: new ( AsyncLogResult {
357
+ commits : Vec :: new ( ) ,
358
+ duration : Duration :: default ( ) ,
359
+ } ) ) ;
360
+ let arc_background = Arc :: new ( AtomicBool :: new ( false ) ) ;
361
+
362
+ let result = AsyncLog :: fetch_helper_without_filter (
363
+ & subdir_path,
364
+ & arc_current,
365
+ & arc_background,
366
+ & tx_git,
367
+ ) ;
368
+
369
+ assert ! ( result. is_ok( ) ) ;
370
+ }
371
+ }
0 commit comments