BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e2e11670
Unverified
Commit
e2e11670
authored
Nov 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix default branch being cached and show old one after change
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
44c55307
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
update_context.rb
app/contexts/projects/update_context.rb
+3
-1
project.rb
app/models/project.rb
+5
-0
No files found.
app/contexts/projects/update_context.rb
View file @
e2e11670
...
@@ -5,12 +5,14 @@ module Projects
...
@@ -5,12 +5,14 @@ module Projects
params
[
:project
].
delete
(
:public
)
unless
can?
(
current_user
,
:change_public_mode
,
project
)
params
[
:project
].
delete
(
:public
)
unless
can?
(
current_user
,
:change_public_mode
,
project
)
new_branch
=
params
[
:project
].
delete
(
:default_branch
)
new_branch
=
params
[
:project
].
delete
(
:default_branch
)
if
project
.
repository
.
exists?
&&
new_branch
!=
project
.
repository
.
root_ref
if
project
.
repository
.
exists?
&&
new_branch
!=
project
.
default_branch
GitlabShellWorker
.
perform_async
(
GitlabShellWorker
.
perform_async
(
:update_repository_head
,
:update_repository_head
,
project
.
path_with_namespace
,
project
.
path_with_namespace
,
new_branch
new_branch
)
)
project
.
reload_default_branch
end
end
project
.
update_attributes
(
params
[
:project
],
as:
role
)
project
.
update_attributes
(
params
[
:project
],
as:
role
)
...
...
app/models/project.rb
View file @
e2e11670
...
@@ -451,4 +451,9 @@ class Project < ActiveRecord::Base
...
@@ -451,4 +451,9 @@ class Project < ActiveRecord::Base
def
default_branch
def
default_branch
@default_branch
||=
repository
.
root_ref
if
repository
.
exists?
@default_branch
||=
repository
.
root_ref
if
repository
.
exists?
end
end
def
reload_default_branch
@default_branch
=
nil
default_branch
end
end
end
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