Skip to content

Commit e302808

Browse files
committed
rename _diff to the function we are actually wrapping
1 parent b26bb55 commit e302808

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

ext/rugged/rugged_tree.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,24 +474,25 @@ static VALUE rb_git_tree_path(VALUE self, VALUE rb_path)
474474
* other_tree = Rugged::Tree.lookup(repo, "7a9e0b02e63179929fed24f0a3e0f19168114d10")
475475
* diff = tree.diff(other_tree)
476476
*/
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)
478478
{
479479
git_tree *tree = NULL;
480480
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
481481
git_repository *repo = NULL;
482482
git_diff *diff = NULL;
483+
git_index *index;
483484
int error;
484485

485486
Data_Get_Struct(rb_repo, git_repository, repo);
487+
Data_Get_Struct(rb_other, git_index, index);
488+
486489
rugged_parse_diff_options(&opts, rb_options);
487490

488-
if (!NIL_P(rb_self)) {
491+
if (RTEST(rb_self)) {
489492
Data_Get_Struct(rb_self, git_tree, tree);
490493
}
491494

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);
495496

496497
xfree(opts.pathspec.strings);
497498
rugged_exception_check(error);
@@ -1021,7 +1022,7 @@ void Init_rugged_tree(void)
10211022
rb_define_method(rb_cRuggedTree, "update", rb_git_tree_update, 1);
10221023
rb_define_singleton_method(rb_cRuggedTree, "empty", rb_git_tree_empty, 1);
10231024

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);
10251026
rb_define_private_method(rb_singleton_class(rb_cRuggedTree), "diff_tree_to_tree", rb_git_diff_tree_to_tree, 4);
10261027

10271028
rb_cRuggedTreeBuilder = rb_define_class_under(rb_cRuggedTree, "Builder", rb_cObject);

lib/rugged/tree.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def self.diff(repo, _self, other = nil, options = {})
2222
when Rugged::Tree
2323
diff_tree_to_tree repo, _self, other, options
2424
when Rugged::Index
25-
_diff(repo, _self, other, options)
25+
diff_tree_to_index repo, _self, other, options
2626
else
2727
raise TypeError, "A Rugged::Commit, Rugged::Tree or Rugged::Index instance is required"
2828
end

0 commit comments

Comments
 (0)