From 5e0919efe162dd686cb1c8e9103ca17315e239c6 Mon Sep 17 00:00:00 2001 From: rick Date: Tue, 7 Dec 2010 13:26:18 -0800 Subject: [PATCH] remove unused method that breaks due to dependence on unreleased grit. whew --- lib/gollum/git_access.rb | 49 ---------------------------------------- test/test_git_access.rb | 8 ------- 2 files changed, 57 deletions(-) diff --git a/lib/gollum/git_access.rb b/lib/gollum/git_access.rb index 9306c893..150044d3 100644 --- a/lib/gollum/git_access.rb +++ b/lib/gollum/git_access.rb @@ -72,23 +72,6 @@ module Gollum 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. # # Returns nothing. @@ -136,21 +119,6 @@ module Gollum # 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. # # str - Possible String SHA. @@ -230,23 +198,6 @@ module Gollum cache[key] = value || :_nil 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. # # line - A String line of output: diff --git a/test/test_git_access.rb b/test/test_git_access.rb index ef13fbeb..914e7d96 100644 --- a/test/test_git_access.rb +++ b/test/test_git_access.rb @@ -13,14 +13,6 @@ context "GitAccess" do assert_equal actual.message, @access.commit_map[actual.id].message 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 assert @access.ref_map.empty? assert @access.tree_map.empty?