summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-10-18 01:17:52 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-10-18 01:17:52 -0700
commit757ea634665e475bf69c1ec962040a0511ee8aeb (patch)
tree1023d2363591df608e2bf3db0777305a4ae73cb9
parentef2bf1520489a23ff64224c3e102a03b46243dbf (diff)
parenta39d0431cb2dec082cd5353f3c212833e49b3490 (diff)
downloadgitlab-ce-757ea634665e475bf69c1ec962040a0511ee8aeb.tar.gz
Merge pull request #31 from klynch/1x
Must ensure that the lock is always removed.
-rw-r--r--app/models/project.rb2
-rw-r--r--lib/gitosis.rb13
2 files changed, 9 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 3c07976d24e..2340940ba5f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
:uniqueness => true,
:format => { :with => /^[a-zA-Z0-9_\-]*$/,
:message => "only letters, digits & '_' '-' allowed" },
- :length => { :within => 3..16 }
+ :length => { :within => 3..255 }
validates :owner,
:presence => true
diff --git a/lib/gitosis.rb b/lib/gitosis.rb
index a9eef96cd3f..4cc5e6e3d08 100644
--- a/lib/gitosis.rb
+++ b/lib/gitosis.rb
@@ -27,13 +27,16 @@ class Gitosis
def configure
status = Timeout::timeout(20) do
File.open(File.join(Dir.tmpdir,"gitlabhq-gitosis.lock"), "w+") do |f|
- f.flock(File::LOCK_EX)
+ begin
+ f.flock(File::LOCK_EX)
- pull
- yield(self)
- push
+ pull
+ yield(self)
+ push
- f.flock(File::LOCK_UN)
+ ensure
+ f.flock(File::LOCK_UN)
+ end
end
end
rescue Exception => ex