Topic: Problem with commit file to Git Repository with Grit plugin

I have problem with commit upload file to Git repository when I use this code:

      project_name = "git/project"+project.id.to_s+"_system.git"
      name =  upload['datafile'].original_filename
      require 'grit'
      Dir.chdir(project_name) do
        r = Grit::Repo.new('.')
        r.working_dir = '/home/.../'+project_name
        i = r.index
        i.add(name, upload['datafile'].read)
        commits = r.commits
        actor = Grit::Actor.new(@current_user.name+' '+@current_user.surname, @current_user.email)
        sha = i.commit(Time.now.to_s, commits, actor)
      end

Every commit sending file to repository but older file was removing. I working on it for a few days and I can't fixed it.

Last edited by wafcio (2011-04-09 16:09:57)