Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implement select_existing_objects

  • Loading branch information...
commit 0bd0c5ff037c7368b2b1827fadc66741d1ed14ed 1 parent 1937a1e
@mojombo authored
Showing with 14 additions and 0 deletions.
  1. +6 −0 lib/grit/git.rb
  2. +8 −0 test/test_repo.rb
View
6 lib/grit/git.rb
@@ -27,6 +27,12 @@ def object_exists?(object_id)
ruby_git.object_exists?(object_id)
end
+ def select_existing_objects(object_ids)
+ object_ids.select do |object_id|
+ object_exists?(object_id)
+ end
+ end
+
class << self
attr_accessor :git_binary, :git_timeout, :git_max_size
end
View
8 test/test_repo.rb
@@ -354,4 +354,12 @@ def test_commit_deltas_from_when_other_has_new
delta_blobs = @r.commit_deltas_from(other_repo)
assert_equal 3, delta_blobs.size
end
+
+ # object_exist
+
+ def test_select_existing_objects
+ before = ['634396b2f541a9f2d58b00be1a07f0c358b999b3', 'deadbeef']
+ after = ['634396b2f541a9f2d58b00be1a07f0c358b999b3']
+ assert_equal after, @r.git.select_existing_objects(before)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.