lib/docman/git_util.rb in docman-0.0.69 vs lib/docman/git_util.rb in docman-0.0.70
- old
+ new
@@ -13,10 +13,16 @@
@logger.info result if show_result and result
raise "ERROR: #{result}" unless $?.exitstatus == 0
result
end
+ def self.squash_commits(commit_count, message = nil)
+ message = "$(git log --format=%B --reverse HEAD..HEAD@{1})" unless message
+ exec "reset --soft HEAD~#{commit_count}"
+ exec "commit -m \"#{message}\""
+ end
+
def self.reset_repo(path)
Dir.chdir path
exec 'reset --hard'
exec 'clean -f -d'
end
@@ -72,14 +78,14 @@
exec('pull')
end
def self.commit(root_path, path, message, tag = nil)
if repo_changed? path
- # puts message
pull root_path
exec %Q(add --all #{path.slice "#{root_path}/"})
exec %Q(commit -m "#{message}") if repo_changed? path
self.tag(root_path, tag) if tag
+ Docman::Application.instance.commit_count = Docman::Application.instance.commit_count + 1
end
end
def self.pull(path, options = nil)
Dir.chdir path
\ No newline at end of file