1 require 'git/raw/internal/object'
2 require 'git/raw/internal/pack'
3 require 'git/raw/internal/loose'
4 require 'git/raw/object'
10 def initialize(git_dir)
12 @loose = Raw::Internal::LooseStorage.new(git_path("objects"))
22 puts "**#{p[s].type}**"
23 if p[s].type.to_s == 'commit'
33 get_raw_object_by_sha1(sha).content rescue nil
36 def log(sha, count = 30)
40 while sha && (i < count) do
41 o = get_raw_object_by_sha1(sha)
42 c = Git::Raw::Object.from_raw(o)
44 output += "commit #{sha}\n"
45 output += o.content + "\n"
54 def get_object_by_sha1(sha1)
55 r = get_raw_object_by_sha1(sha1)
57 Object.from_raw(r, self)
60 def get_raw_object_by_sha1(sha1)
61 sha1 = [sha1].pack("H*")
73 # try packs again, maybe the object got packed in the meantime
86 return "#@git_dir/#{path}"
96 Dir.open(git_path("objects/pack/")) do |dir|
98 if entry =~ /\.pack$/i
99 @packs << Git::Raw::Internal::PackStorage.new(git_path("objects/pack/" \