1 require 'git/internal/object'
2 require 'git/internal/pack'
3 require 'git/internal/loose'
8 def initialize(git_dir)
10 @loose = Internal::LooseStorage.new("#@git_dir/objects")
15 def get_object_by_sha1(sha1)
16 r = get_raw_object_by_sha1(sha1)
18 Object.from_raw(r, self)
21 def get_raw_object_by_sha1(sha1)
22 sha1 = [sha1].pack("H*")
34 # try packs again, maybe the object got packed in the meantime
49 Dir.glob("#@git_dir/objects/pack/pack-*.pack").each do |pack|
50 @packs << Git::Internal::PackStorage.new(pack)
58 r = Git::Repository.new(ARGV[0])
59 ARGV[1..-1].each do |sha1|
60 o = r.get_object_by_sha1(sha1)
70 puts o.entry.collect { |e| "%s %s" % [e.sha1, e.name] }.join("\n")