@@ -121,7 +121,7 @@ impl<'repo> delegate::Navigate for Delegate<'repo> {
121121 let lookup_path = |obj : & ObjectId | {
122122 let tree_id = peel ( repo, obj, gix_object:: Kind :: Tree ) ?;
123123 if path. is_empty ( ) {
124- return Ok ( tree_id) ;
124+ return Ok ( ( tree_id, gix_object :: tree :: EntryKind :: Tree . into ( ) ) ) ;
125125 }
126126 let mut tree = repo. find_object ( tree_id) ?. into_tree ( ) ;
127127 let entry =
@@ -131,11 +131,17 @@ impl<'repo> delegate::Navigate for Delegate<'repo> {
131131 object : obj. attach ( repo) . shorten_or_id ( ) ,
132132 tree : tree_id. attach ( repo) . shorten_or_id ( ) ,
133133 } ) ?;
134- Ok ( entry. object_id ( ) )
134+ Ok ( ( entry. object_id ( ) , entry . mode ( ) ) )
135135 } ;
136136 for obj in objs. iter ( ) {
137137 match lookup_path ( obj) {
138- Ok ( replace) => replacements. push ( ( * obj, replace) ) ,
138+ Ok ( ( replace, mode) ) => {
139+ if !path. is_empty ( ) {
140+ // Technically this is letting the last one win, but so be it.
141+ self . paths [ self . idx ] = Some ( ( path. to_owned ( ) , mode) ) ;
142+ }
143+ replacements. push ( ( * obj, replace) )
144+ }
139145 Err ( err) => errors. push ( ( * obj, err) ) ,
140146 }
141147 }
@@ -306,6 +312,14 @@ impl<'repo> delegate::Navigate for Delegate<'repo> {
306312 self . objs [ self . idx ]
307313 . get_or_insert_with ( HashSet :: default)
308314 . insert ( entry. id ) ;
315+
316+ self . paths [ self . idx ] = Some ( (
317+ path. to_owned ( ) ,
318+ entry
319+ . mode
320+ . to_tree_entry_mode ( )
321+ . unwrap_or ( gix_object:: tree:: EntryKind :: Blob . into ( ) ) ,
322+ ) ) ;
309323 Some ( ( ) )
310324 }
311325 None => {
0 commit comments