@@ -33,13 +33,13 @@ pub struct IndexConflicts<'index> {
3333/// A structure to represent the information returned when a conflict is detected in an index entry
3434pub struct IndexConflict {
3535 /// The ancestor index entry of the two conflicting index entries
36- pub ancestor : IndexEntry ,
36+ pub ancestor : Option < IndexEntry > ,
3737 /// The index entry originating from the user's copy of the repository.
3838 /// Its contents conflict with 'their' index entry
39- pub our : IndexEntry ,
39+ pub our : Option < IndexEntry > ,
4040 /// The index entry originating from the external repository.
4141 /// Its contents conflict with 'our' index entry
42- pub their : IndexEntry ,
42+ pub their : Option < IndexEntry > ,
4343}
4444
4545/// A callback function to filter index matches.
@@ -588,9 +588,18 @@ impl<'index> Iterator for IndexConflicts<'index> {
588588 self . conflict_iter
589589 ) ) ;
590590 Some ( Ok ( IndexConflict {
591- ancestor : IndexEntry :: from_raw ( * ancestor) ,
592- our : IndexEntry :: from_raw ( * our) ,
593- their : IndexEntry :: from_raw ( * their) ,
591+ ancestor : match ancestor. is_null ( ) {
592+ false => Some ( IndexEntry :: from_raw ( * ancestor) ) ,
593+ true => None ,
594+ } ,
595+ our : match our. is_null ( ) {
596+ false => Some ( IndexEntry :: from_raw ( * our) ) ,
597+ true => None ,
598+ } ,
599+ their : match their. is_null ( ) {
600+ false => Some ( IndexEntry :: from_raw ( * their) ) ,
601+ true => None ,
602+ } ,
594603 } ) )
595604 }
596605 }
0 commit comments