Skip to content

Commit 5c2efa3

Browse files
committed
move tree handling to Ruby
1 parent 69c07df commit 5c2efa3

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

ext/rugged/rugged_tree.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,7 @@ static VALUE rb_git_tree_diff_(VALUE self, VALUE rb_repo, VALUE rb_self, VALUE r
489489
Data_Get_Struct(rb_self, git_tree, tree);
490490
}
491491

492-
if (rb_obj_is_kind_of(rb_other, rb_cRuggedTree)) {
493-
git_tree *other_tree;
494-
495-
Data_Get_Struct(rb_other, git_tree, other_tree);
496-
error = git_diff_tree_to_tree(&diff, repo, tree, other_tree, &opts);
497-
} else if (rb_obj_is_kind_of(rb_other, rb_cRuggedIndex)) {
492+
if (rb_obj_is_kind_of(rb_other, rb_cRuggedIndex)) {
498493
git_index *index;
499494
Data_Get_Struct(rb_other, git_index, index);
500495
error = git_diff_tree_to_index(&diff, repo, tree, index, &opts);

lib/rugged/tree.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def self.diff(repo, _self, other = nil, options = {})
1919
case other
2020
when Rugged::Commit
2121
diff_tree_to_tree repo, _self, other.tree, options
22+
when Rugged::Tree
23+
diff_tree_to_tree repo, _self, other, options
2224
else
2325
_diff(repo, _self, other, options)
2426
end

0 commit comments

Comments
 (0)