Commit 8134fe0e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

git host fixed

parent 8f4a0bd1
...@@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base ...@@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base
end end
def require_non_empty_project def require_non_empty_project
redirect_to @project unless @project.repo_exists? redirect_to @project unless @project.repo_exists? && @project.has_commits?
end end
def respond_with_notes def respond_with_notes
......
...@@ -65,7 +65,7 @@ class ProjectsController < ApplicationController ...@@ -65,7 +65,7 @@ class ProjectsController < ApplicationController
end end
def show def show
return render "projects/empty" unless @project.repo_exists? return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
limit = (params[:limit] || 20).to_i limit = (params[:limit] || 20).to_i
@activities = @project.cached_updates(limit) @activities = @project.cached_updates(limit)
end end
......
...@@ -52,6 +52,8 @@ class RefsController < ApplicationController ...@@ -52,6 +52,8 @@ class RefsController < ApplicationController
@commit = project.commit(@ref) @commit = project.commit(@ref)
@tree = Tree.new(@commit.tree, project, @ref, params[:path]) @tree = Tree.new(@commit.tree, project, @ref, params[:path])
@tree = TreeDecorator.new(@tree) @tree = TreeDecorator.new(@tree)
rescue
return render_404
end end
def ref def ref
......
...@@ -19,7 +19,7 @@ class Key < ActiveRecord::Base ...@@ -19,7 +19,7 @@ class Key < ActiveRecord::Base
end end
def update_gitosis def update_gitosis
GitoProxy.system.new.configure do |c| Gitlabhq::GitHost.system.new.configure do |c|
c.update_keys(identifier, key) c.update_keys(identifier, key)
projects.each do |project| projects.each do |project|
...@@ -29,7 +29,7 @@ class Key < ActiveRecord::Base ...@@ -29,7 +29,7 @@ class Key < ActiveRecord::Base
end end
def gitosis_delete_key def gitosis_delete_key
GitoProxy.system.new.configure do |c| Gitlabhq::GitHost.system.new.configure do |c|
c.delete_key(identifier) c.delete_key(identifier)
projects.each do |project| projects.each do |project|
......
...@@ -95,6 +95,10 @@ class Project < ActiveRecord::Base ...@@ -95,6 +95,10 @@ class Project < ActiveRecord::Base
notes.where(:noteable_id => commit.id, :noteable_type => "Commit") notes.where(:noteable_id => commit.id, :noteable_type => "Commit")
end end
def has_commits?
!!commit
end
def add_access(user, *access) def add_access(user, *access)
opts = { :user => user } opts = { :user => user }
access.each { |name| opts.merge!(name => true) } access.each { |name| opts.merge!(name => true) }
......
...@@ -11,7 +11,7 @@ email: ...@@ -11,7 +11,7 @@ email:
# But gitosis wiil be deprecated & # But gitosis wiil be deprecated &
# some new features wont work with it # some new features wont work with it
git_host: git_host:
system: gitolite# or gitosis system: gitolite
admin_uri: git@localhost:gitolite-admin admin_uri: git@localhost:gitolite-admin
base_path: /home/git/repositories/ base_path: /home/git/repositories/
host: localhost host: localhost
......
...@@ -4,10 +4,10 @@ require File.join(Rails.root, "lib", "gitlabhq", "gitosis") ...@@ -4,10 +4,10 @@ require File.join(Rails.root, "lib", "gitlabhq", "gitosis")
module Gitlabhq module Gitlabhq
class GitHost class GitHost
def self.system def self.system
if GIT_HOST["system"] == "gitolite" if GIT_HOST["system"] == "gitosis"
Gitlabhq::Gitolite
else
Gitlabhq::Gitosis Gitlabhq::Gitosis
else
Gitlabhq::Gitolite
end end
end end
......
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