history.rb revision 03dee28977299b4b40210d9b7842bf85c136ab7d
# depends on GitRepository
if path.nil?
else
end
end
commits = []
walker.each do |c|
commits << to_hash(c)
end
commits
end
def commits_path(walker, path)
commits = []
object = nil
commit = nil
walker.each do | previous_commit |
previous_object = get_object(previous_commit, path)
if object_added(object, previous_object, !commit.nil?) ||
object_changed(object, previous_object, !commit.nil?) ||
object_deleted(object, previous_object, !commit.nil?)
commits << to_hash(commit)
end
object = previous_object
commit = previous_commit
end
unless object.nil?
commits << to_hash(commit)
end
commits
end
def to_hash(commit)
{
message: commit.message,
committer: commit.committer,
author: commit.author,
oid: commit.oid
}
end
def object_changed(object, previous_object, started)
started && !object.nil? && !previous_object.nil? && object.oid != previous_object.oid
end
def object_added(object, previous_object, started)
started && !object.nil? && previous_object.nil?
end
def object_deleted(object, previous_object, started)
started && object.nil? && !previous_object.nil?
end
end