@@ -412,6 +412,42 @@ fn inside_submodule() {
412412 insta:: assert_snapshot!( ctx. redact_buffer( ) ) ;
413413}
414414
415+ #[ test]
416+ fn inside_shallow ( ) {
417+ let mut ctx = setup_clone ! ( ) ;
418+ let url = Url :: from_file_path ( & ctx. remote_dir ) . unwrap ( ) . to_string ( ) ;
419+ run ( & ctx. dir , & [ "git" , "clone" , "--depth=1" , & url, "shallow" ] ) ;
420+
421+ let _app = ctx. init_app_at_path ( ctx. dir . join ( "shallow" ) ) ;
422+ insta:: assert_snapshot!( ctx. redact_buffer( ) ) ;
423+ }
424+
425+ #[ test]
426+ fn inside_worktree ( ) {
427+ let mut ctx = setup_clone ! ( ) ;
428+ run ( & ctx. dir , & [ "git" , "checkout" , "-b" , "new-branch" ] ) ;
429+ run ( & ctx. dir , & [ "git" , "worktree" , "add" , "main" ] ) ;
430+
431+ let _app = ctx. init_app_at_path ( ctx. dir . join ( "main" ) ) ;
432+ insta:: assert_snapshot!( ctx. redact_buffer( ) ) ;
433+ }
434+
435+ #[ test]
436+ fn inside_shallow_worktree ( ) {
437+ let mut ctx = setup_clone ! ( ) ;
438+ clone_and_commit ( & ctx. remote_dir , "new-file" , "hello" ) ;
439+
440+ let url = Url :: from_file_path ( & ctx. remote_dir ) . unwrap ( ) . to_string ( ) ;
441+ run ( & ctx. dir , & [ "git" , "clone" , "--depth=1" , & url, "shallow" ] ) ;
442+
443+ let shallow_dir = ctx. dir . join ( "shallow" ) ;
444+ run ( & shallow_dir, & [ "git" , "checkout" , "-b" , "new-branch" ] ) ;
445+ run ( & shallow_dir, & [ "git" , "worktree" , "add" , "main" ] ) ;
446+
447+ let _app = ctx. init_app_at_path ( shallow_dir. join ( "main" ) ) ;
448+ insta:: assert_snapshot!( ctx. redact_buffer( ) ) ;
449+ }
450+
415451#[ test]
416452fn syntax_highlighted ( ) {
417453 let ctx = setup_clone ! ( ) ;
0 commit comments