put_raw_object

in lib/grit/git-ruby/internal/loose.rb [64:84]


        def put_raw_object(content, type)
          size = content.bytesize.to_s
          LooseStorage.verify_header(type, size)

          header = "#{type} #{size}\0"
          store = header + content

          sha1 = Digest::SHA1.hexdigest(store)
          path = @directory+'/'+sha1[0...2]+'/'+sha1[2..40]

          if !File.exists?(path)
            content = Zlib::Deflate.deflate(store)

            FileUtils.mkdir_p(@directory+'/'+sha1[0...2])
            File.open(path, 'wb') do |f|
              f.write content
            end
          end
          return sha1
        end