Commit 757ea634665e475bf69c1ec962040a0511ee8aeb
Exists in
master
and in
4 other branches
Merge pull request #31 from klynch/1x
Must ensure that the lock is always removed.
Showing
2 changed files
with
9 additions
and
6 deletions
Show diff stats
app/models/project.rb
| ... | ... | @@ -28,7 +28,7 @@ class Project < ActiveRecord::Base |
| 28 | 28 | :uniqueness => true, |
| 29 | 29 | :format => { :with => /^[a-zA-Z0-9_\-]*$/, |
| 30 | 30 | :message => "only letters, digits & '_' '-' allowed" }, |
| 31 | - :length => { :within => 3..16 } | |
| 31 | + :length => { :within => 3..255 } | |
| 32 | 32 | |
| 33 | 33 | validates :owner, |
| 34 | 34 | :presence => true | ... | ... |
lib/gitosis.rb
| ... | ... | @@ -27,13 +27,16 @@ class Gitosis |
| 27 | 27 | def configure |
| 28 | 28 | status = Timeout::timeout(20) do |
| 29 | 29 | File.open(File.join(Dir.tmpdir,"gitlabhq-gitosis.lock"), "w+") do |f| |
| 30 | - f.flock(File::LOCK_EX) | |
| 30 | + begin | |
| 31 | + f.flock(File::LOCK_EX) | |
| 31 | 32 | |
| 32 | - pull | |
| 33 | - yield(self) | |
| 34 | - push | |
| 33 | + pull | |
| 34 | + yield(self) | |
| 35 | + push | |
| 35 | 36 | |
| 36 | - f.flock(File::LOCK_UN) | |
| 37 | + ensure | |
| 38 | + f.flock(File::LOCK_UN) | |
| 39 | + end | |
| 37 | 40 | end |
| 38 | 41 | end |
| 39 | 42 | rescue Exception => ex | ... | ... |