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
|
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
|
||||||
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
|
||||||
@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
|
||||||
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
|
||||||
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
|
||||||
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:
|
||||||
# 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")
|
||||||
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue