File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -544,7 +544,19 @@ pub(crate) fn trusted_file_path<'config>(
544544 let install_dir = crate :: path:: install_dir ( ) . ok ( ) ;
545545 let home = home_dir ( environment) ;
546546 let ctx = config:: cache:: interpolate_context ( install_dir. as_deref ( ) , home. as_deref ( ) ) ;
547- Some ( path. interpolate ( ctx) )
547+
548+ let is_optional = path. is_optional ;
549+ let res = path. interpolate ( ctx) ;
550+ if is_optional {
551+ if let Ok ( path) = & res {
552+ // As opposed to Git, for a lack of the right error variant, we ignore everything that can't
553+ // be stat'ed, instead of just checking if it doesn't exist via error code.
554+ if path. metadata ( ) . is_err ( ) {
555+ return None ;
556+ }
557+ }
558+ }
559+ Some ( res)
548560}
549561
550562pub ( crate ) fn home_dir ( environment : crate :: open:: permissions:: Environment ) -> Option < PathBuf > {
You can’t perform that action at this time.
0 commit comments