Method: Docman::GitUtil.commit

Defined in:
lib/docman/git_util.rb

.commit(root_path, path, message, tag = nil) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/docman/git_util.rb', line 91

def self.commit(root_path, path, message, tag = nil)
  if repo_changed? path
    # pull root_path
    Dir.chdir root_path
    exec %Q(add --all #{path.slice "#{root_path}/"})
    if repo_changed? path
      if Application::instance.options.has_key?('debug')
        exec %Q(commit --allow-empty --no-verify -m "#{message}")
      else
        exec %Q(commit --allow-empty --quiet --no-verify -m "#{message}")
      end
    end

    self.tag(root_path, tag) if tag
    Docman::Application.instance.commit_count = Docman::Application.instance.commit_count + 1
  end
end