Commit 21f3da23589d50038728393f0badc6255b5762ca
1 parent
204c6646
Exists in
master
and in
4 other branches
Make sure tmp/merge_repo is available to write lock files for auto-merge.
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
lib/gitlab_merge.rb
... | ... | @@ -25,8 +25,12 @@ class GitlabMerge |
25 | 25 | end |
26 | 26 | |
27 | 27 | def process |
28 | - Grit::Git.with_timeout(30.seconds) do | |
29 | - File.open(File.join(Rails.root, "tmp", "merge_repo", "#{project.path}.lock"), "w+") do |f| | |
28 | + Grit::Git.with_timeout(30.seconds) do | |
29 | + # Make sure tmp/merge_repo exists | |
30 | + lock_path = File.join(Rails.root, "tmp", "merge_repo") | |
31 | + FileUtils.mkdir_p(lock_path) unless File.exists?(File.join(Rails.root, "tmp", "merge_repo")) | |
32 | + | |
33 | + File.open(File.join(lock_path, "#{project.path}.lock"), "w+") do |f| | |
30 | 34 | f.flock(File::LOCK_EX) |
31 | 35 | |
32 | 36 | unless project.satellite.exists? | ... | ... |