Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
253680bb
Commit
253680bb
authored
Nov 06, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improve/default_branch' of /home/git/repositories/gitlab/gitlabhq
parents
d618a5fe
7ab3bf96
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
34 additions
and
22 deletions
+34
-22
CHANGELOG
CHANGELOG
+2
-0
app/contexts/projects/update_context.rb
app/contexts/projects/update_context.rb
+10
-0
app/models/project.rb
app/models/project.rb
+8
-2
app/models/repository.rb
app/models/repository.rb
+1
-1
app/observers/project_observer.rb
app/observers/project_observer.rb
+0
-6
db/migrate/20131106151520_remove_default_branch.rb
db/migrate/20131106151520_remove_default_branch.rb
+9
-0
db/schema.rb
db/schema.rb
+1
-2
doc/api/projects.md
doc/api/projects.md
+0
-1
features/steps/public/projects_feature.rb
features/steps/public/projects_feature.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+0
-2
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+2
-2
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+0
-5
No files found.
CHANGELOG
View file @
253680bb
...
...
@@ -9,6 +9,8 @@ v 6.3.0
- Fixed issue with 500 error when group did not exist
- Ability to leave project
- You can create file in repo using UI
- API: dropped default_branch attribute from project during creation
- Project default_branch is not stored in db any more. It takes from repo now.
v 6.2.0
- Public project pages are now visible to everyone (files, issues, wik, etc.)
...
...
app/contexts/projects/update_context.rb
View file @
253680bb
...
...
@@ -3,6 +3,16 @@ module Projects
def
execute
(
role
=
:default
)
params
[
:project
].
delete
(
:namespace_id
)
params
[
:project
].
delete
(
:public
)
unless
can?
(
current_user
,
:change_public_mode
,
project
)
new_branch
=
params
[
:project
].
delete
(
:default_branch
)
if
project
.
repository
.
exists?
&&
new_branch
!=
project
.
repository
.
root_ref
GitlabShellWorker
.
perform_async
(
:update_repository_head
,
project
.
path_with_namespace
,
new_branch
)
end
project
.
update_attributes
(
params
[
:project
],
as:
role
)
end
end
...
...
app/models/project.rb
View file @
253680bb
...
...
@@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
include
Gitlab
::
ShellAdapter
extend
Enumerize
attr_accessible
:name
,
:path
,
:description
,
:
default_branch
,
:
issues_tracker
,
:label_list
,
attr_accessible
:name
,
:path
,
:description
,
:issues_tracker
,
:label_list
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:snippets_enabled
,
:issues_tracker_id
,
:wiki_enabled
,
:public
,
:import_url
,
:last_activity_at
,
as:
[
:default
,
:admin
]
...
...
@@ -36,6 +36,8 @@ class Project < ActiveRecord::Base
acts_as_taggable_on
:labels
,
:issues_default_labels
attr_accessor
:new_default_branch
# Relations
belongs_to
:creator
,
foreign_key:
"creator_id"
,
class_name:
"User"
belongs_to
:group
,
foreign_key:
"namespace_id"
,
conditions:
"type = 'Group'"
...
...
@@ -143,7 +145,7 @@ class Project < ActiveRecord::Base
end
def
repository
@repository
||=
Repository
.
new
(
path_with_namespace
,
default_branch
)
@repository
||=
Repository
.
new
(
path_with_namespace
)
end
def
saved?
...
...
@@ -451,4 +453,8 @@ class Project < ActiveRecord::Base
def
project_member
(
user
)
users_projects
.
where
(
user_id:
user
).
first
end
def
default_branch
@default_branch
||=
repository
.
root_ref
if
repository
.
exists?
end
end
app/models/repository.rb
View file @
253680bb
...
...
@@ -3,7 +3,7 @@ class Repository
attr_accessor
:raw_repository
,
:path_with_namespace
def
initialize
(
path_with_namespace
,
default_branch
)
def
initialize
(
path_with_namespace
,
default_branch
=
nil
)
@path_with_namespace
=
path_with_namespace
@raw_repository
=
Gitlab
::
Git
::
Repository
.
new
(
path_to_repo
)
if
path_with_namespace
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
...
...
app/observers/project_observer.rb
View file @
253680bb
...
...
@@ -30,12 +30,6 @@ class ProjectObserver < BaseObserver
def
after_update
(
project
)
project
.
send_move_instructions
if
project
.
namespace_id_changed?
project
.
rename_repo
if
project
.
path_changed?
GitlabShellWorker
.
perform_async
(
:update_repository_head
,
project
.
path_with_namespace
,
project
.
default_branch
)
if
project
.
default_branch_changed?
end
def
before_destroy
(
project
)
...
...
db/migrate/20131106151520_remove_default_branch.rb
0 → 100644
View file @
253680bb
class
RemoveDefaultBranch
<
ActiveRecord
::
Migration
def
up
remove_column
:projects
,
:default_branch
end
def
down
add_column
:projects
,
:default_branch
,
:string
end
end
db/schema.rb
View file @
253680bb
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
20131
009115346
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
20131
106151520
)
do
create_table
"deploy_keys_projects"
,
:force
=>
true
do
|
t
|
t
.
integer
"deploy_key_id"
,
:null
=>
false
...
...
@@ -171,7 +171,6 @@ ActiveRecord::Schema.define(:version => 20131009115346) do
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
integer
"creator_id"
t
.
string
"default_branch"
t
.
boolean
"issues_enabled"
,
:default
=>
true
,
:null
=>
false
t
.
boolean
"wall_enabled"
,
:default
=>
true
,
:null
=>
false
t
.
boolean
"merge_requests_enabled"
,
:default
=>
true
,
:null
=>
false
...
...
doc/api/projects.md
View file @
253680bb
...
...
@@ -213,7 +213,6 @@ Parameters:
+
`name`
(required) - new project name
+
`description`
(optional) - short project description
+
`default_branch`
(optional) - 'master' by default
+
`issues_enabled`
(optional)
+
`wall_enabled`
(optional)
+
`merge_requests_enabled`
(optional)
...
...
features/steps/public/projects_feature.rb
View file @
253680bb
...
...
@@ -23,7 +23,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
end
step
'public project "Community"'
do
create
:project_with_code
,
name:
'Community'
,
public:
true
,
default_branch:
'master'
create
:project_with_code
,
name:
'Community'
,
public:
true
end
step
'public empty project "Empty Public Project"'
do
...
...
lib/api/projects.rb
View file @
253680bb
...
...
@@ -60,7 +60,6 @@ module API
# Parameters:
# name (required) - name for new project
# description (optional) - short project description
# default_branch (optional) - 'master' by default
# issues_enabled (optional)
# wall_enabled (optional)
# merge_requests_enabled (optional)
...
...
@@ -75,7 +74,6 @@ module API
attrs
=
attributes_for_keys
[
:name
,
:path
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
...
...
spec/models/merge_request_spec.rb
View file @
253680bb
...
...
@@ -116,13 +116,13 @@ describe MergeRequest do
end
it
'accesses the set of issues that will be closed on acceptance'
do
subject
.
project
.
default_branch
=
subject
.
target_branch
subject
.
project
.
stub
(
default_branch:
subject
.
target_branch
)
subject
.
closes_issues
.
should
==
[
issue0
,
issue1
].
sort_by
(
&
:id
)
end
it
'only lists issues as to be closed if it targets the default branch'
do
subject
.
project
.
default_branch
=
'master'
subject
.
project
.
stub
(
default_branch:
'master'
)
subject
.
target_branch
=
'something-else'
subject
.
closes_issues
.
should
be_empty
...
...
spec/requests/api/projects_spec.rb
View file @
253680bb
...
...
@@ -91,7 +91,6 @@ describe API::API do
it
"should assign attributes to project"
do
project
=
attributes_for
(
:project
,
{
description:
Faker
::
Lorem
.
sentence
,
default_branch:
'stable'
,
issues_enabled:
false
,
wall_enabled:
false
,
merge_requests_enabled:
false
,
...
...
@@ -110,16 +109,13 @@ describe API::API do
project
=
attributes_for
(
:project
,
{
public:
true
})
post
api
(
"/projects"
,
user
),
project
json_response
[
'public'
].
should
be_true
end
it
"should set a project as private"
do
project
=
attributes_for
(
:project
,
{
public:
false
})
post
api
(
"/projects"
,
user
),
project
json_response
[
'public'
].
should
be_false
end
end
describe
"POST /projects/user/:id"
do
...
...
@@ -146,7 +142,6 @@ describe API::API do
it
"should assign attributes to project"
do
project
=
attributes_for
(
:project
,
{
description:
Faker
::
Lorem
.
sentence
,
default_branch:
'stable'
,
issues_enabled:
false
,
wall_enabled:
false
,
merge_requests_enabled:
false
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment