diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 380336f3526..1f971302889 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base end def require_non_empty_project - redirect_to @project unless @project.repo_exists? + redirect_to @project unless @project.repo_exists? && @project.has_commits? end def respond_with_notes diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a0899151596..4b8c196b375 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -65,7 +65,7 @@ class ProjectsController < ApplicationController end 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 @activities = @project.cached_updates(limit) end diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index 66924b8de9d..d2be5ad51db 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -52,6 +52,8 @@ class RefsController < ApplicationController @commit = project.commit(@ref) @tree = Tree.new(@commit.tree, project, @ref, params[:path]) @tree = TreeDecorator.new(@tree) + rescue + return render_404 end def ref diff --git a/app/models/key.rb b/app/models/key.rb index f2f0134cde5..572f002b5bc 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -19,7 +19,7 @@ class Key < ActiveRecord::Base end def update_gitosis - GitoProxy.system.new.configure do |c| + Gitlabhq::GitHost.system.new.configure do |c| c.update_keys(identifier, key) projects.each do |project| @@ -29,7 +29,7 @@ class Key < ActiveRecord::Base end def gitosis_delete_key - GitoProxy.system.new.configure do |c| + Gitlabhq::GitHost.system.new.configure do |c| c.delete_key(identifier) projects.each do |project| diff --git a/app/models/project.rb b/app/models/project.rb index e3fb9c941e8..f4841653996 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -95,6 +95,10 @@ class Project < ActiveRecord::Base notes.where(:noteable_id => commit.id, :noteable_type => "Commit") end + def has_commits? + !!commit + end + def add_access(user, *access) opts = { :user => user } access.each { |name| opts.merge!(name => true) } diff --git a/config/gitlab.yml b/config/gitlab.yml index 5e85af788b4..e861031e5ee 100644 --- a/config/gitlab.yml +++ b/config/gitlab.yml @@ -11,7 +11,7 @@ email: # But gitosis wiil be deprecated & # some new features wont work with it git_host: - system: gitolite# or gitosis + system: gitolite admin_uri: git@localhost:gitolite-admin base_path: /home/git/repositories/ host: localhost diff --git a/lib/gitlabhq/git_host.rb b/lib/gitlabhq/git_host.rb index 48f5a150740..714d92f537a 100644 --- a/lib/gitlabhq/git_host.rb +++ b/lib/gitlabhq/git_host.rb @@ -4,10 +4,10 @@ require File.join(Rails.root, "lib", "gitlabhq", "gitosis") module Gitlabhq class GitHost def self.system - if GIT_HOST["system"] == "gitolite" - Gitlabhq::Gitolite - else + if GIT_HOST["system"] == "gitosis" Gitlabhq::Gitosis + else + Gitlabhq::Gitolite end end