@@ -135,6 +135,8 @@ pub mod convert_to_diffable {
135135 pub enum Error {
136136 #[ error( "Entry at '{rela_path}' must be regular file or symlink, but was {actual:?}" ) ]
137137 InvalidEntryKind { rela_path : BString , actual : EntryKind } ,
138+ #[ error( "Entry at '{rela_path}' is declared as symlink but symlinks are disabled via core.symlinks" ) ]
139+ SymlinkDisabled { rela_path : BString } ,
138140 #[ error( "Entry at '{rela_path}' could not be read as symbolic link" ) ]
139141 ReadLink { rela_path : BString , source : std:: io:: Error } ,
140142 #[ error( "Entry at '{rela_path}' could not be opened for reading or read from" ) ]
@@ -240,7 +242,7 @@ impl Pipeline {
240242 out : & mut Vec < u8 > ,
241243 ) -> Result < Outcome , convert_to_diffable:: Error > {
242244 let is_symlink = match mode {
243- EntryKind :: Link if self . options . fs . symlink => true ,
245+ EntryKind :: Link => true ,
244246 EntryKind :: Blob | EntryKind :: BlobExecutable => false ,
245247 _ => {
246248 return Err ( convert_to_diffable:: Error :: InvalidEntryKind {
@@ -272,6 +274,11 @@ impl Pipeline {
272274 self . path . push ( root) ;
273275 self . path . push ( gix_path:: from_bstr ( rela_path) ) ;
274276 let data = if is_symlink {
277+ if !self . options . fs . symlink {
278+ return Err ( convert_to_diffable:: Error :: SymlinkDisabled {
279+ rela_path : rela_path. to_owned ( ) ,
280+ } ) ;
281+ }
275282 let target = none_if_missing ( std:: fs:: read_link ( & self . path ) ) . map_err ( |err| {
276283 convert_to_diffable:: Error :: ReadLink {
277284 rela_path : rela_path. to_owned ( ) ,
0 commit comments