File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ impl ThreadSafeRepository {
153153
154154 let git_dir_trust = gix_sec:: Trust :: from_path_ownership ( & git_dir) ?;
155155 let mut options = trust_map. into_value_by_level ( git_dir_trust) ;
156+ options. git_dir_trust = git_dir_trust. into ( ) ;
156157 options. current_dir = Some ( cwd) ;
157158 ThreadSafeRepository :: open_from_paths ( git_dir, worktree_dir, options)
158159 }
Original file line number Diff line number Diff line change @@ -10,6 +10,32 @@ fn open_permissions_is_isolated() {
1010 assert ! ( !gix:: open:: Permissions :: all( ) . is_isolated( ) ) ;
1111}
1212
13+ #[ test]
14+ #[ serial_test:: serial]
15+ fn discover_with_git_dir_environment_override_sets_trust ( ) -> crate :: Result {
16+ let tmp = gix_testtools:: tempfile:: TempDir :: new ( ) ?;
17+ let initialized = gix:: init ( tmp. path ( ) ) ?;
18+ let _env = gix_testtools:: Env :: new ( )
19+ . unset ( "GIT_WORK_TREE" )
20+ . set ( "GIT_DIR" , initialized. git_dir ( ) . to_string_lossy ( ) . into_owned ( ) ) ;
21+
22+ let repo = gix:: ThreadSafeRepository :: discover_with_environment_overrides_opts (
23+ tmp. path ( ) ,
24+ Default :: default ( ) ,
25+ gix_sec:: trust:: Mapping {
26+ full : crate :: restricted ( ) ,
27+ reduced : crate :: restricted ( ) ,
28+ } ,
29+ ) ?;
30+
31+ assert_eq ! (
32+ repo. git_dir( ) ,
33+ initialized. git_dir( ) ,
34+ "the git-dir from the environment opens without panicking on missing trust"
35+ ) ;
36+ Ok ( ( ) )
37+ }
38+
1339#[ test]
1440fn on_root_with_decomposed_unicode ( ) -> crate :: Result {
1541 let tmp = gix_testtools:: tempfile:: TempDir :: new ( ) ?;
You can’t perform that action at this time.
0 commit comments