Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/rugged/diff/delta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def typechange?
status == :typechange
end

def old_blob
owner.owner.lookup(old_file[:oid]) unless added?
end

def new_blob
owner.owner.lookup(new_file[:oid]) unless deleted?
end

def inspect
"#<#{self.class.name}:#{object_id} {old_file: #{old_file.inspect}, new_file: #{new_file.inspect}, similarity: #{similarity.inspect}, status: #{status.inspect}>"
end
Expand Down
5 changes: 5 additions & 0 deletions lib/rugged/tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def diff(other = nil, options = nil)
Tree.diff(repo, self, other, options)
end

def lookup(entry_id)
entry = get_entry(entry_id)
owner.lookup(entry[:oid]) if entry
end

def inspect
data = "#<Rugged::Tree:#{object_id} {oid: #{oid}}>\n"
self.each { |e| data << " <\"#{e[:name]}\" #{e[:oid]}>\n" }
Expand Down