File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -371,25 +371,30 @@ pub fn get_diff(
371
371
gix_repo
372
372
. head_tree ( ) ?
373
373
. lookup_entry_by_path ( p)
374
+ . map ( |entry| {
375
+ entry. map_or_else (
376
+ || ObjectId :: null ( gix:: hash:: Kind :: Sha1 ) ,
377
+ |entry| entry. object_id ( ) ,
378
+ )
379
+ } )
380
+ . unwrap_or ( ObjectId :: null ( gix:: hash:: Kind :: Sha1 ) ) ,
374
381
None ,
375
382
)
376
383
} else {
377
384
(
378
- gix_repo
379
- . index ( ) ?
380
- . entry_by_path ( p. into ( ) )
381
- . expect ( "TODO" )
382
- . id ,
385
+ gix_repo. index ( ) ?. entry_by_path ( p. into ( ) ) . map_or (
386
+ ObjectId :: null ( gix:: hash:: Kind :: Sha1 ) ,
387
+ |entry| entry. id ,
388
+ ) ,
383
389
None ,
384
390
)
385
391
} ;
386
392
let ( new_blob_id, new_root) = if stage {
387
393
(
388
- gix_repo
389
- . index ( ) ?
390
- . entry_by_path ( p. into ( ) )
391
- . expect ( "TODO" )
392
- . id ,
394
+ gix_repo. index ( ) ?. entry_by_path ( p. into ( ) ) . map_or (
395
+ ObjectId :: null ( gix:: hash:: Kind :: Sha1 ) ,
396
+ |entry| entry. id ,
397
+ ) ,
393
398
None ,
394
399
)
395
400
} else {
You can’t perform that action at this time.
0 commit comments