From 65608b6aaa2101ec74cc64824bef6544aa052480 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Date: Tue, 18 Oct 2011 11:21:44 +0300
Subject: [PATCH] few fixes

---
 app/models/project.rb              |  2 +-
 app/views/projects/_form.html.haml |  2 +-
 lib/gitosis.rb                     | 15 ++++++++-------
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/app/models/project.rb b/app/models/project.rb
index 3366b87816..f51bd9b3ad 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -29,7 +29,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/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index 9dbe57d223..00ca98efa0 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -24,7 +24,7 @@
         %td 
           .left= f.label :code
           %cite.right http://yourserver/
-        %td= f.text_field :code, :placeholder => "example (3..12 symbols only)"
+        %td= f.text_field :code, :placeholder => "example"
     .field
       = f.label :description
       %br/
diff --git a/lib/gitosis.rb b/lib/gitosis.rb
index a9eef96cd3..cab7da2d43 100644
--- a/lib/gitosis.rb
+++ b/lib/gitosis.rb
@@ -27,13 +27,14 @@ 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)
-
-        pull
-        yield(self)
-        push
-
-        f.flock(File::LOCK_UN)
+        begin 
+          f.flock(File::LOCK_EX)
+          pull
+          yield(self)
+          push
+        ensure
+          f.flock(File::LOCK_UN)
+        end
       end
     end
   rescue Exception => ex
-- 
2.30.9