Commit 8134fe0efe287f6512b7684d4c654b2d43f3df9d
1 parent
8f4a0bd1
Exists in
master
and in
4 other branches
git host fixed
Showing
7 changed files
with
14 additions
and
8 deletions
Show diff stats
app/controllers/application_controller.rb
| @@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base | @@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base | ||
| 70 | end | 70 | end |
| 71 | 71 | ||
| 72 | def require_non_empty_project | 72 | def require_non_empty_project |
| 73 | - redirect_to @project unless @project.repo_exists? | 73 | + redirect_to @project unless @project.repo_exists? && @project.has_commits? |
| 74 | end | 74 | end |
| 75 | 75 | ||
| 76 | def respond_with_notes | 76 | def respond_with_notes |
app/controllers/projects_controller.rb
| @@ -65,7 +65,7 @@ class ProjectsController < ApplicationController | @@ -65,7 +65,7 @@ class ProjectsController < ApplicationController | ||
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | def show | 67 | def show |
| 68 | - return render "projects/empty" unless @project.repo_exists? | 68 | + return render "projects/empty" unless @project.repo_exists? && @project.has_commits? |
| 69 | limit = (params[:limit] || 20).to_i | 69 | limit = (params[:limit] || 20).to_i |
| 70 | @activities = @project.cached_updates(limit) | 70 | @activities = @project.cached_updates(limit) |
| 71 | end | 71 | end |
app/controllers/refs_controller.rb
| @@ -52,6 +52,8 @@ class RefsController < ApplicationController | @@ -52,6 +52,8 @@ class RefsController < ApplicationController | ||
| 52 | @commit = project.commit(@ref) | 52 | @commit = project.commit(@ref) |
| 53 | @tree = Tree.new(@commit.tree, project, @ref, params[:path]) | 53 | @tree = Tree.new(@commit.tree, project, @ref, params[:path]) |
| 54 | @tree = TreeDecorator.new(@tree) | 54 | @tree = TreeDecorator.new(@tree) |
| 55 | + rescue | ||
| 56 | + return render_404 | ||
| 55 | end | 57 | end |
| 56 | 58 | ||
| 57 | def ref | 59 | def ref |
app/models/key.rb
| @@ -19,7 +19,7 @@ class Key < ActiveRecord::Base | @@ -19,7 +19,7 @@ class Key < ActiveRecord::Base | ||
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | def update_gitosis | 21 | def update_gitosis |
| 22 | - GitoProxy.system.new.configure do |c| | 22 | + Gitlabhq::GitHost.system.new.configure do |c| |
| 23 | c.update_keys(identifier, key) | 23 | c.update_keys(identifier, key) |
| 24 | 24 | ||
| 25 | projects.each do |project| | 25 | projects.each do |project| |
| @@ -29,7 +29,7 @@ class Key < ActiveRecord::Base | @@ -29,7 +29,7 @@ class Key < ActiveRecord::Base | ||
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | def gitosis_delete_key | 31 | def gitosis_delete_key |
| 32 | - GitoProxy.system.new.configure do |c| | 32 | + Gitlabhq::GitHost.system.new.configure do |c| |
| 33 | c.delete_key(identifier) | 33 | c.delete_key(identifier) |
| 34 | 34 | ||
| 35 | projects.each do |project| | 35 | projects.each do |project| |
app/models/project.rb
| @@ -95,6 +95,10 @@ class Project < ActiveRecord::Base | @@ -95,6 +95,10 @@ class Project < ActiveRecord::Base | ||
| 95 | notes.where(:noteable_id => commit.id, :noteable_type => "Commit") | 95 | notes.where(:noteable_id => commit.id, :noteable_type => "Commit") |
| 96 | end | 96 | end |
| 97 | 97 | ||
| 98 | + def has_commits? | ||
| 99 | + !!commit | ||
| 100 | + end | ||
| 101 | + | ||
| 98 | def add_access(user, *access) | 102 | def add_access(user, *access) |
| 99 | opts = { :user => user } | 103 | opts = { :user => user } |
| 100 | access.each { |name| opts.merge!(name => true) } | 104 | access.each { |name| opts.merge!(name => true) } |
config/gitlab.yml
| @@ -11,7 +11,7 @@ email: | @@ -11,7 +11,7 @@ email: | ||
| 11 | # But gitosis wiil be deprecated & | 11 | # But gitosis wiil be deprecated & |
| 12 | # some new features wont work with it | 12 | # some new features wont work with it |
| 13 | git_host: | 13 | git_host: |
| 14 | - system: gitolite# or gitosis | 14 | + system: gitolite |
| 15 | admin_uri: git@localhost:gitolite-admin | 15 | admin_uri: git@localhost:gitolite-admin |
| 16 | base_path: /home/git/repositories/ | 16 | base_path: /home/git/repositories/ |
| 17 | host: localhost | 17 | host: localhost |
lib/gitlabhq/git_host.rb
| @@ -4,10 +4,10 @@ require File.join(Rails.root, "lib", "gitlabhq", "gitosis") | @@ -4,10 +4,10 @@ require File.join(Rails.root, "lib", "gitlabhq", "gitosis") | ||
| 4 | module Gitlabhq | 4 | module Gitlabhq |
| 5 | class GitHost | 5 | class GitHost |
| 6 | def self.system | 6 | def self.system |
| 7 | - if GIT_HOST["system"] == "gitolite" | ||
| 8 | - Gitlabhq::Gitolite | ||
| 9 | - else | 7 | + if GIT_HOST["system"] == "gitosis" |
| 10 | Gitlabhq::Gitosis | 8 | Gitlabhq::Gitosis |
| 9 | + else | ||
| 10 | + Gitlabhq::Gitolite | ||
| 11 | end | 11 | end |
| 12 | end | 12 | end |
| 13 | 13 |