@@ -474,24 +474,25 @@ static VALUE rb_git_tree_path(VALUE self, VALUE rb_path)
474
474
* other_tree = Rugged::Tree.lookup(repo, "7a9e0b02e63179929fed24f0a3e0f19168114d10")
475
475
* diff = tree.diff(other_tree)
476
476
*/
477
- static VALUE rb_git_tree_diff_ (VALUE self , VALUE rb_repo , VALUE rb_self , VALUE rb_other , VALUE rb_options )
477
+ static VALUE rb_git_diff_tree_to_index (VALUE self , VALUE rb_repo , VALUE rb_self , VALUE rb_other , VALUE rb_options )
478
478
{
479
479
git_tree * tree = NULL ;
480
480
git_diff_options opts = GIT_DIFF_OPTIONS_INIT ;
481
481
git_repository * repo = NULL ;
482
482
git_diff * diff = NULL ;
483
+ git_index * index ;
483
484
int error ;
484
485
485
486
Data_Get_Struct (rb_repo , git_repository , repo );
487
+ Data_Get_Struct (rb_other , git_index , index );
488
+
486
489
rugged_parse_diff_options (& opts , rb_options );
487
490
488
- if (! NIL_P (rb_self )) {
491
+ if (RTEST (rb_self )) {
489
492
Data_Get_Struct (rb_self , git_tree , tree );
490
493
}
491
494
492
- git_index * index ;
493
- Data_Get_Struct (rb_other , git_index , index );
494
- error = git_diff_tree_to_index (& diff , repo , tree , index , & opts );
495
+ error = git_diff_tree_to_index (& diff , repo , tree , index , & opts );
495
496
496
497
xfree (opts .pathspec .strings );
497
498
rugged_exception_check (error );
@@ -1021,7 +1022,7 @@ void Init_rugged_tree(void)
1021
1022
rb_define_method (rb_cRuggedTree , "update" , rb_git_tree_update , 1 );
1022
1023
rb_define_singleton_method (rb_cRuggedTree , "empty" , rb_git_tree_empty , 1 );
1023
1024
1024
- rb_define_private_method (rb_singleton_class (rb_cRuggedTree ), "_diff " , rb_git_tree_diff_ , 4 );
1025
+ rb_define_private_method (rb_singleton_class (rb_cRuggedTree ), "diff_tree_to_index " , rb_git_diff_tree_to_index , 4 );
1025
1026
rb_define_private_method (rb_singleton_class (rb_cRuggedTree ), "diff_tree_to_tree" , rb_git_diff_tree_to_tree , 4 );
1026
1027
1027
1028
rb_cRuggedTreeBuilder = rb_define_class_under (rb_cRuggedTree , "Builder" , rb_cObject );
0 commit comments