File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -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.
You can’t perform that action at this time.
0 commit comments