Commit d68ec5e0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

default_branch for project & fixed project destroy

parent 2552a877
...@@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base ...@@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base
else else
@branch = params[:branch].blank? ? nil : params[:branch] @branch = params[:branch].blank? ? nil : params[:branch]
@tag = params[:tag].blank? ? nil : params[:tag] @tag = params[:tag].blank? ? nil : params[:tag]
@ref = @branch || @tag || Repository.default_ref @ref = @branch || @tag || @project.try(:default_branch) || Repository.default_ref
end end
end end
......
...@@ -158,7 +158,7 @@ class Project < ActiveRecord::Base ...@@ -158,7 +158,7 @@ class Project < ActiveRecord::Base
end end
def root_ref def root_ref
"master" default_branch || "master"
end end
def public? def public?
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
%span{ :class => "number" }= @project.snippets.non_expired.count %span{ :class => "number" }= @project.snippets.non_expired.count
- if can? current_user, :admin_project, @project - if can? current_user, :admin_project, @project
= link_to "Project", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil = link_to "Admin", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil
.medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
%cite.right= "http://#{GIT_HOST["host"]}/" %cite.right= "http://#{GIT_HOST["host"]}/"
%td= f.text_field :code, :placeholder => "example" %td= f.text_field :code, :placeholder => "example"
- unless @project.heads.empty?
%tr
%td= f.label :default_branch, "Default Branch"
%td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;")
%tr %tr
%td= f.label :tag_list %td= f.label :tag_list
%td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
...@@ -57,4 +62,5 @@ ...@@ -57,4 +62,5 @@
:javascript :javascript
$(function(){ $(function(){
taggifyForm(); taggifyForm();
$('form #project_default_branch').chosen();
}) })
class AddDefaultBranchToProject < ActiveRecord::Migration
def change
add_column :projects, :default_branch, :string, :null => false, :default => "master"
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111206222316) do ActiveRecord::Schema.define(:version => 20111207211728) do
create_table "features", :force => true do |t| create_table "features", :force => true do |t|
t.string "name" t.string "name"
...@@ -79,6 +79,7 @@ ActiveRecord::Schema.define(:version => 20111206222316) do ...@@ -79,6 +79,7 @@ ActiveRecord::Schema.define(:version => 20111206222316) do
t.boolean "private_flag", :default => true, :null => false t.boolean "private_flag", :default => true, :null => false
t.string "code" t.string "code"
t.integer "owner_id" t.integer "owner_id"
t.string "default_branch", :default => "master", :null => false
end end
create_table "snippets", :force => true do |t| create_table "snippets", :force => true do |t|
......
...@@ -42,7 +42,7 @@ module Gitlabhq ...@@ -42,7 +42,7 @@ module Gitlabhq
end end
def destroy_project(project) def destroy_project(project)
`sudo -u git rm -rf #{project.path_to_repo}` FileUtils.rm_rf(project.path_to_repo)
ga_repo = ::Gitolite::GitoliteAdmin.new(File.join(@local_dir,'gitolite')) ga_repo = ::Gitolite::GitoliteAdmin.new(File.join(@local_dir,'gitolite'))
conf = ga_repo.config conf = ga_repo.config
......
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