lib/git_store.rb
# Write the commit object to disk and set the head of the current branch.
#
# Returns the id of the commit object
Write the commit object to disk and set the head of the current branch.
Returns the id of the commit object
Write the commit object to disk and set the head of the current branch . Returns the id of the commit object
def commit(message = '', author = 'ruby', committer = 'ruby')
    time = "#{ Time.now.to_i } #{ Time.now.to_s.split[4] }"
    tree = root.write_to_store
    contents = [ "tree #{tree}", (head and "parent #{head}"),
                 "author #{author} #{time}",
                 "committer #{committer} #{time}", '', message
                 ].compact.join("\n")
    id = put_object(contents, 'commit')
    open(head_path, "wb") do |file|
      file.write(id)
    end
    @head = id
  end
def commit ( message = '' , author = 'ruby' , committer = 'ruby' ) time = "#{ Time.now.to_i } #{ Time.now.to_s.split[4] }" tree = root . write_to_store contents = [ "tree #{tree}" , ( head and "parent #{head}" ) , "author #{author} #{time}" , "committer #{committer} #{time}" , '' , message ] . compact . join ( "\n" ) id = put_object ( contents , 'commit' ) open ( head_path , "wb" ) do | file | file . write ( id ) end @head = id end
Write the commit object to disk and set the head of the current branch.
Write the commit object to disk and set the head of the current branch .
message
author
committer