remove unused method that breaks due to dependence on unreleased grit. whew
This commit is contained in:
@@ -72,23 +72,6 @@ module Gollum
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Gets a list of Git commits.
|
|
||||||
#
|
|
||||||
# *shas - An Array of String SHAs.
|
|
||||||
#
|
|
||||||
# Returns an Array of Grit::Commit instances.
|
|
||||||
def commits(*shas)
|
|
||||||
shas.flatten!
|
|
||||||
cached_commits = multi_get(:commit, shas)
|
|
||||||
missing_shas = shas.select do |sha|
|
|
||||||
!cached_commits.key?(sha)
|
|
||||||
end
|
|
||||||
|
|
||||||
multi_commit!(missing_shas, cached_commits) if !missing_shas.empty?
|
|
||||||
|
|
||||||
shas.map { |sha| cached_commits[sha] }
|
|
||||||
end
|
|
||||||
|
|
||||||
# Public: Clears all of the cached data that this GitAccess is tracking.
|
# Public: Clears all of the cached data that this GitAccess is tracking.
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
@@ -136,21 +119,6 @@ module Gollum
|
|||||||
#
|
#
|
||||||
attr_reader :commit_map
|
attr_reader :commit_map
|
||||||
|
|
||||||
# Raw method for fetching a list of Git commits.
|
|
||||||
#
|
|
||||||
# shas - An Array of String SHAs.
|
|
||||||
# hash - Optional Hash to store the found commits, indexed by their SHA.
|
|
||||||
#
|
|
||||||
# Returns the same Hash instance.
|
|
||||||
def multi_commit!(shas, hash = {})
|
|
||||||
shas.each_slice(500) do |slice|
|
|
||||||
@repo.batch(slice).each do |commit|
|
|
||||||
hash[commit.id] = commit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Checks to see if the given String is a 40 character hex SHA.
|
# Checks to see if the given String is a 40 character hex SHA.
|
||||||
#
|
#
|
||||||
# str - Possible String SHA.
|
# str - Possible String SHA.
|
||||||
@@ -230,23 +198,6 @@ module Gollum
|
|||||||
cache[key] = value || :_nil
|
cache[key] = value || :_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Gets multiple values from the cache in a single call.
|
|
||||||
#
|
|
||||||
# name - The cache prefix used in building the full cache key.
|
|
||||||
# keys - Array of cache key names to fetch.
|
|
||||||
#
|
|
||||||
# Returns a Hash of the objects that were found in the cache, indexed by
|
|
||||||
# the cache key.
|
|
||||||
def multi_get(name, keys)
|
|
||||||
value = instance_variable_get("@#{name}_map")
|
|
||||||
keys.inject({}) do |memo, key|
|
|
||||||
if v = value[key]
|
|
||||||
memo[key] = v
|
|
||||||
end
|
|
||||||
memo
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Parses a line of output from the `ls-tree` command.
|
# Parses a line of output from the `ls-tree` command.
|
||||||
#
|
#
|
||||||
# line - A String line of output:
|
# line - A String line of output:
|
||||||
|
|||||||
@@ -13,14 +13,6 @@ context "GitAccess" do
|
|||||||
assert_equal actual.message, @access.commit_map[actual.id].message
|
assert_equal actual.message, @access.commit_map[actual.id].message
|
||||||
end
|
end
|
||||||
|
|
||||||
test "#commits uses commit_map" do
|
|
||||||
actual = @access.repo.commits.first
|
|
||||||
@access.commit_map['abc'] = 1
|
|
||||||
commits = @access.commits('abc', actual.id)
|
|
||||||
assert_equal 1, commits[0]
|
|
||||||
assert_equal actual.message, commits[1].message
|
|
||||||
end
|
|
||||||
|
|
||||||
test "#tree_map_for caches ref and tree" do
|
test "#tree_map_for caches ref and tree" do
|
||||||
assert @access.ref_map.empty?
|
assert @access.ref_map.empty?
|
||||||
assert @access.tree_map.empty?
|
assert @access.tree_map.empty?
|
||||||
|
|||||||
Reference in New Issue
Block a user