Skip to content

Commit 7571340

Browse files
committed
Move an is_a check + cast to Ruby
1 parent 91cfa00 commit 7571340

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ext/rugged/rugged_tree.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,6 @@ 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 (TYPE(rb_other) == T_STRING)
493-
rb_other = rugged_object_rev_parse(rb_repo, rb_other, 1);
494-
495492
if (rb_obj_is_kind_of(rb_other, rb_cRuggedCommit)) {
496493
git_tree *other_tree;
497494
git_commit *commit;

lib/rugged/tree.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def self.diff(repo, _self, other = nil, options = {})
1212
diff_tree_to_tree repo, _self, options
1313
end
1414
else
15+
if other.is_a?(::String)
16+
other = Rugged::Object.rev_parse repo, other
17+
end
18+
1519
_diff(repo, _self, other, options)
1620
end
1721
end

0 commit comments

Comments
 (0)