@@ -412,6 +412,39 @@ impl Index {
412412 unsafe { raw:: git_index_has_conflicts ( self . raw ) == 1 }
413413 }
414414
415+ /// Get the index entries that represent a conflict of a single file.
416+ pub fn conflict_get ( & self , path : & Path ) -> Result < IndexConflict , Error > {
417+ let path = path_to_repo_path ( path) ?;
418+ let mut ancestor = ptr:: null ( ) ;
419+ let mut our = ptr:: null ( ) ;
420+ let mut their = ptr:: null ( ) ;
421+
422+ unsafe {
423+ try_call ! ( raw:: git_index_conflict_get(
424+ & mut ancestor,
425+ & mut our,
426+ & mut their,
427+ self . raw,
428+ path
429+ ) ) ;
430+
431+ Ok ( IndexConflict {
432+ ancestor : match ancestor. is_null ( ) {
433+ false => Some ( IndexEntry :: from_raw ( * ancestor) ) ,
434+ true => None ,
435+ } ,
436+ our : match our. is_null ( ) {
437+ false => Some ( IndexEntry :: from_raw ( * our) ) ,
438+ true => None ,
439+ } ,
440+ their : match their. is_null ( ) {
441+ false => Some ( IndexEntry :: from_raw ( * their) ) ,
442+ true => None ,
443+ } ,
444+ } )
445+ }
446+ }
447+
415448 /// Get the full path to the index file on disk.
416449 ///
417450 /// Returns `None` if this is an in-memory index.
@@ -489,10 +522,7 @@ impl Index {
489522 pub fn conflict_remove ( & mut self , path : & Path ) -> Result < ( ) , Error > {
490523 let path = path_to_repo_path ( path) ?;
491524 unsafe {
492- try_call ! ( raw:: git_index_conflict_remove(
493- self . raw,
494- path
495- ) ) ;
525+ try_call ! ( raw:: git_index_conflict_remove( self . raw, path) ) ;
496526 }
497527 Ok ( ( ) )
498528 }
0 commit comments