Commit d68ec5e0fb156e56c2e057eefe2e473d72d44c1f
1 parent
2552a877
Exists in
master
and in
4 other branches
default_branch for project & fixed project destroy
Showing
7 changed files
with
18 additions
and
6 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base |
61 | 61 | else |
62 | 62 | @branch = params[:branch].blank? ? nil : params[:branch] |
63 | 63 | @tag = params[:tag].blank? ? nil : params[:tag] |
64 | - @ref = @branch || @tag || Repository.default_ref | |
64 | + @ref = @branch || @tag || @project.try(:default_branch) || Repository.default_ref | |
65 | 65 | end |
66 | 66 | end |
67 | 67 | ... | ... |
app/models/project.rb
app/views/layouts/project.html.haml
... | ... | @@ -49,7 +49,7 @@ |
49 | 49 | %span{ :class => "number" }= @project.snippets.non_expired.count |
50 | 50 | |
51 | 51 | - if can? current_user, :admin_project, @project |
52 | - = link_to "Project", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil | |
52 | + = link_to "Admin", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil | |
53 | 53 | |
54 | 54 | .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project |
55 | 55 | ... | ... |
app/views/projects/_form.html.haml
... | ... | @@ -29,6 +29,11 @@ |
29 | 29 | %cite.right= "http://#{GIT_HOST["host"]}/" |
30 | 30 | %td= f.text_field :code, :placeholder => "example" |
31 | 31 | |
32 | + - unless @project.heads.empty? | |
33 | + %tr | |
34 | + %td= f.label :default_branch, "Default Branch" | |
35 | + %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;") | |
36 | + | |
32 | 37 | %tr |
33 | 38 | %td= f.label :tag_list |
34 | 39 | %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field |
... | ... | @@ -57,4 +62,5 @@ |
57 | 62 | :javascript |
58 | 63 | $(function(){ |
59 | 64 | taggifyForm(); |
65 | + $('form #project_default_branch').chosen(); | |
60 | 66 | }) | ... | ... |
db/migrate/20111207211728_add_default_branch_to_project.rb
0 → 100644
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20111206222316) do | |
14 | +ActiveRecord::Schema.define(:version => 20111207211728) do | |
15 | 15 | |
16 | 16 | create_table "features", :force => true do |t| |
17 | 17 | t.string "name" |
... | ... | @@ -76,9 +76,10 @@ ActiveRecord::Schema.define(:version => 20111206222316) do |
76 | 76 | t.text "description" |
77 | 77 | t.datetime "created_at" |
78 | 78 | t.datetime "updated_at" |
79 | - t.boolean "private_flag", :default => true, :null => false | |
79 | + t.boolean "private_flag", :default => true, :null => false | |
80 | 80 | t.string "code" |
81 | 81 | t.integer "owner_id" |
82 | + t.string "default_branch", :default => "master", :null => false | |
82 | 83 | end |
83 | 84 | |
84 | 85 | create_table "snippets", :force => true do |t| | ... | ... |
lib/gitlabhq/gitolite.rb
... | ... | @@ -42,7 +42,7 @@ module Gitlabhq |
42 | 42 | end |
43 | 43 | |
44 | 44 | def destroy_project(project) |
45 | - `sudo -u git rm -rf #{project.path_to_repo}` | |
45 | + FileUtils.rm_rf(project.path_to_repo) | |
46 | 46 | |
47 | 47 | ga_repo = ::Gitolite::GitoliteAdmin.new(File.join(@local_dir,'gitolite')) |
48 | 48 | conf = ga_repo.config | ... | ... |