lib/git_store.rb
# Write a raw object to the repository.
#
# Returns the object id.
Write a raw object to the repository.
Returns the object id.
Write a raw object to the repository . Returns the object id .
def put_object(content, type)
    size = content.length.to_s    
    header = "#{type} #{size}\0"
    data = header + content
    id = sha(data)
    path = object_path(id)    
    unless File.exists?(path)
      FileUtils.mkpath(File.dirname(path))
      open(path, 'wb') do |f|
        f.write Zlib::Deflate.deflate(data)
      end
    end
    id
  end
def put_object ( content , type ) size = content . length . to_s header = "#{type} #{size}\0" data = header + content id = sha ( data ) path = object_path ( id ) unless File . exists? ( path ) FileUtils . mkpath ( File . dirname ( path ) ) open ( path , 'wb' ) do | f | f . write Zlib :: Deflate . deflate ( data ) end end id end
Write a raw object to the repository.
Write a raw object to the repository .
content
type