@@ -84,7 +84,7 @@ pub(crate) struct EnvironmentOverrides {
84
84
}
85
85
86
86
impl EnvironmentOverrides {
87
- fn from_env ( ) -> Result < Self , crate :: permission:: env_var:: resource:: Error > {
87
+ fn from_env ( ) -> Result < Self , permission:: env_var:: resource:: Error > {
88
88
let mut worktree_dir = None ;
89
89
if let Some ( path) = std:: env:: var_os ( "GIT_WORK_TREE" ) {
90
90
worktree_dir = PathBuf :: from ( path) . into ( ) ;
@@ -186,7 +186,7 @@ impl Options {
186
186
}
187
187
188
188
/// Open a repository at `path` with the options set so far.
189
- pub fn open ( self , path : impl Into < std :: path :: PathBuf > ) -> Result < ThreadSafeRepository , Error > {
189
+ pub fn open ( self , path : impl Into < PathBuf > ) -> Result < ThreadSafeRepository , Error > {
190
190
ThreadSafeRepository :: open_opts ( path, self )
191
191
}
192
192
}
@@ -197,17 +197,17 @@ impl git_sec::trust::DefaultForLevel for Options {
197
197
git_sec:: Trust :: Full => Options {
198
198
object_store_slots : Default :: default ( ) ,
199
199
replacement_objects : Default :: default ( ) ,
200
- permissions : Permissions :: all ( ) ,
200
+ permissions : Permissions :: default_for_level ( level ) ,
201
201
git_dir_trust : git_sec:: Trust :: Full . into ( ) ,
202
202
filter_config_section : Some ( config:: section:: is_trusted) ,
203
203
lossy_config : None ,
204
204
} ,
205
205
git_sec:: Trust :: Reduced => Options {
206
206
object_store_slots : git_odb:: store:: init:: Slots :: Given ( 32 ) , // limit resource usage
207
207
replacement_objects : ReplacementObjects :: Disable , // don't be tricked into seeing manufactured objects
208
- permissions : Default :: default ( ) ,
208
+ permissions : Permissions :: default_for_level ( level ) ,
209
209
git_dir_trust : git_sec:: Trust :: Reduced . into ( ) ,
210
- filter_config_section : Some ( crate :: config:: section:: is_trusted) ,
210
+ filter_config_section : Some ( config:: section:: is_trusted) ,
211
211
lossy_config : None ,
212
212
} ,
213
213
}
@@ -219,28 +219,28 @@ impl git_sec::trust::DefaultForLevel for Options {
219
219
#[ allow( missing_docs) ]
220
220
pub enum Error {
221
221
#[ error( transparent) ]
222
- Config ( #[ from] crate :: config:: Error ) ,
222
+ Config ( #[ from] config:: Error ) ,
223
223
#[ error( transparent) ]
224
224
NotARepository ( #[ from] git_discover:: is_git:: Error ) ,
225
225
#[ error( transparent) ]
226
226
ObjectStoreInitialization ( #[ from] std:: io:: Error ) ,
227
227
#[ error( "The git directory at '{}' is considered unsafe as it's not owned by the current user." , . path. display( ) ) ]
228
- UnsafeGitDir { path : std :: path :: PathBuf } ,
228
+ UnsafeGitDir { path : PathBuf } ,
229
229
#[ error( transparent) ]
230
- EnvironmentAccessDenied ( #[ from] crate :: permission:: env_var:: resource:: Error ) ,
230
+ EnvironmentAccessDenied ( #[ from] permission:: env_var:: resource:: Error ) ,
231
231
}
232
232
233
233
impl ThreadSafeRepository {
234
234
/// Open a git repository at the given `path`, possibly expanding it to `path/.git` if `path` is a work tree dir.
235
- pub fn open ( path : impl Into < std :: path :: PathBuf > ) -> Result < Self , Error > {
235
+ pub fn open ( path : impl Into < PathBuf > ) -> Result < Self , Error > {
236
236
Self :: open_opts ( path, Options :: default ( ) )
237
237
}
238
238
239
239
/// Open a git repository at the given `path`, possibly expanding it to `path/.git` if `path` is a work tree dir, and use
240
240
/// `options` for fine-grained control.
241
241
///
242
242
/// Note that you should use [`crate::discover()`] if security should be adjusted by ownership.
243
- pub fn open_opts ( path : impl Into < std :: path :: PathBuf > , mut options : Options ) -> Result < Self , Error > {
243
+ pub fn open_opts ( path : impl Into < PathBuf > , mut options : Options ) -> Result < Self , Error > {
244
244
let ( path, kind) = {
245
245
let path = path. into ( ) ;
246
246
match git_discover:: is_git ( & path) {
@@ -319,7 +319,7 @@ impl ThreadSafeRepository {
319
319
. map ( |cd| git_dir. join ( cd) ) ;
320
320
let common_dir_ref = common_dir. as_deref ( ) . unwrap_or ( & git_dir) ;
321
321
322
- let repo_config = crate :: config:: cache:: StageOne :: new ( common_dir_ref, git_dir_trust, lossy_config) ?;
322
+ let repo_config = config:: cache:: StageOne :: new ( common_dir_ref, git_dir_trust, lossy_config) ?;
323
323
let mut refs = {
324
324
let reflog = repo_config. reflog . unwrap_or ( git_ref:: store:: WriteReflog :: Disable ) ;
325
325
let object_hash = repo_config. object_hash ;
@@ -337,7 +337,7 @@ impl ThreadSafeRepository {
337
337
repo_config,
338
338
common_dir_ref,
339
339
head. as_ref ( ) . and_then ( |head| head. target . try_name ( ) ) ,
340
- filter_config_section. unwrap_or ( crate :: config:: section:: is_trusted) ,
340
+ filter_config_section. unwrap_or ( config:: section:: is_trusted) ,
341
341
git_install_dir. as_deref ( ) ,
342
342
home. as_deref ( ) ,
343
343
env. clone ( ) ,
0 commit comments