Commit 21f3da23 authored by Ariejan de Vroom's avatar Ariejan de Vroom

Make sure tmp/merge_repo is available to write lock files for auto-merge.

parent 204c6646
...@@ -25,8 +25,12 @@ class GitlabMerge ...@@ -25,8 +25,12 @@ class GitlabMerge
end end
def process def process
Grit::Git.with_timeout(30.seconds) do Grit::Git.with_timeout(30.seconds) do
File.open(File.join(Rails.root, "tmp", "merge_repo", "#{project.path}.lock"), "w+") do |f| # Make sure tmp/merge_repo exists
lock_path = File.join(Rails.root, "tmp", "merge_repo")
FileUtils.mkdir_p(lock_path) unless File.exists?(File.join(Rails.root, "tmp", "merge_repo"))
File.open(File.join(lock_path, "#{project.path}.lock"), "w+") do |f|
f.flock(File::LOCK_EX) f.flock(File::LOCK_EX)
unless project.satellite.exists? unless project.satellite.exists?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment