yield the created SHA1 in the after_commit callback
This commit is contained in:
@@ -144,14 +144,15 @@ module Gollum
|
||||
def commit
|
||||
sha1 = index.commit(@options[:message], parents, actor)
|
||||
@callbacks.each do |cb|
|
||||
cb.call(self)
|
||||
cb.call(self, sha1)
|
||||
end
|
||||
sha1
|
||||
end
|
||||
|
||||
# Adds a callback to be fired after a commit.
|
||||
#
|
||||
# block - A block that expects this Committer instance as the argument.
|
||||
# block - A block that expects this Committer instance and the created
|
||||
# commit's SHA1 as the arguments.
|
||||
#
|
||||
# Returns nothing.
|
||||
def after_commit(&block)
|
||||
|
||||
+4
-4
@@ -205,7 +205,7 @@ module Gollum
|
||||
|
||||
committer.add_to_index('', name, format, data)
|
||||
|
||||
committer.after_commit do |index|
|
||||
committer.after_commit do |index, sha|
|
||||
@access.refresh
|
||||
index.update_working_dir('', name, format)
|
||||
end
|
||||
@@ -256,7 +256,7 @@ module Gollum
|
||||
committer.add_to_index(dir, name, format, data, :allow_same_ext)
|
||||
end
|
||||
|
||||
committer.after_commit do |index|
|
||||
committer.after_commit do |index, sha|
|
||||
@access.refresh
|
||||
index.update_working_dir(dir, page.name, page.format)
|
||||
index.update_working_dir(dir, name, format)
|
||||
@@ -293,7 +293,7 @@ module Gollum
|
||||
|
||||
committer.delete(page.path)
|
||||
|
||||
committer.after_commit do |index|
|
||||
committer.after_commit do |index, sha|
|
||||
dir = ::File.dirname(page.path)
|
||||
dir = '' if dir == '.'
|
||||
|
||||
@@ -331,7 +331,7 @@ module Gollum
|
||||
parent = committer.parents[0]
|
||||
committer.options[:tree] = @repo.git.apply_patch(parent.sha, patch)
|
||||
return false unless committer.options[:tree]
|
||||
committer.after_commit do |index|
|
||||
committer.after_commit do |index, sha|
|
||||
@access.refresh
|
||||
|
||||
files = []
|
||||
|
||||
Reference in New Issue
Block a user