git host fixed
This commit is contained in:
parent
8f4a0bd174
commit
8134fe0efe
7 changed files with 14 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue