get_info_list.rb revision 8ec575832389c2588f0b5ca1f1dd2cc42d62eb12
# depends on GitRepository, GetCommit, GetObject, GetFolderContents
# returns information about the last commit of the files in a folder
if !rugged_commit && url_folder.empty?
[]
else
contents.map do |e|
end
end
end
# returns information about the last commit of a file
end
# returns the information of all commits considering a file (commit history of a file)
if !rugged_commit
[]
else
end
end
end
end
{
}
end
entries = []
entries << changing_rugged_commit.oid
previous_rugged_commit = changing_rugged_commit
unless changing_rugged_commit.parents.empty?
changing_rugged_commit = get_commit_of_last_change(url, nil, changing_rugged_commit.parents.first)
end
end
# file does not exist in inital commit
if changing_rugged_commit && !path_exists_rugged?(changing_rugged_commit, url)
entries[0..-2]
else
entries
end
end
def get_commit_of_last_change(url, previous_entry_oid=nil, rugged_commit=nil, previous_rugged_commit=nil)
rugged_commit ||= head
object = get_object(rugged_commit, url)
object_oid = object ? object.oid : nil
previous_entry_oid ||= object_oid unless previous_rugged_commit
if object_oid == previous_entry_oid
if rugged_commit.parents.empty?
rugged_commit
else
parents = rugged_commit.parents.sort_by do |p|
get_commit_of_last_change(url, previous_entry_oid, p, rugged_commit).committer[:time]
end
get_commit_of_last_change(url, previous_entry_oid, parents[-1], rugged_commit)
end
else
previous_rugged_commit
end
end
end