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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1c0def2a
Commit
1c0def2a
authored
Aug 24, 2017
by
Maxim Rydkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace `is_default_branch?` with `default_branch?`
parent
622c912d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
app/services/git_push_service.rb
app/services/git_push_service.rb
+5
-5
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+2
-2
No files found.
app/services/git_push_service.rb
View file @
1c0def2a
...
...
@@ -30,7 +30,7 @@ class GitPushService < BaseService
@project
.
repository
.
after_create_branch
# Re-find the pushed commits.
if
is_
default_branch?
if
default_branch?
# Initial push to the default branch. Take the full history of that branch as "newly pushed".
process_default_branch
else
...
...
@@ -50,7 +50,7 @@ class GitPushService < BaseService
# Update the bare repositories info/attributes file using the contents of the default branches
# .gitattributes file
update_gitattributes
if
is_
default_branch?
update_gitattributes
if
default_branch?
end
execute_related_hooks
...
...
@@ -66,7 +66,7 @@ class GitPushService < BaseService
end
def
update_caches
if
is_
default_branch?
if
default_branch?
if
push_to_new_branch?
# If this is the initial push into the default branch, the file type caches
# will already be reset as a result of `Project#change_head`.
...
...
@@ -108,7 +108,7 @@ class GitPushService < BaseService
# Schedules processing of commit messages.
def
process_commit_messages
default
=
is_
default_branch?
default
=
default_branch?
@push_commits
.
last
(
PROCESS_COMMIT_LIMIT
).
each
do
|
commit
|
if
commit
.
matches_cross_reference_regex?
...
...
@@ -202,7 +202,7 @@ class GitPushService < BaseService
Gitlab
::
Git
.
branch_ref?
(
params
[
:ref
])
end
def
is_
default_branch?
def
default_branch?
Gitlab
::
Git
.
branch_ref?
(
params
[
:ref
])
&&
(
Gitlab
::
Git
.
ref_name
(
params
[
:ref
])
==
project
.
default_branch
||
project
.
default_branch
.
nil?
)
end
...
...
spec/services/git_push_service_spec.rb
View file @
1c0def2a
...
...
@@ -617,7 +617,7 @@ describe GitPushService, services: true do
context
'on the default branch'
do
before
do
allow
(
service
).
to
receive
(
:
is_
default_branch?
).
and_return
(
true
)
allow
(
service
).
to
receive
(
:default_branch?
).
and_return
(
true
)
end
it
'flushes the caches of any special files that have been changed'
do
...
...
@@ -638,7 +638,7 @@ describe GitPushService, services: true do
context
'on a non-default branch'
do
before
do
allow
(
service
).
to
receive
(
:
is_
default_branch?
).
and_return
(
false
)
allow
(
service
).
to
receive
(
:default_branch?
).
and_return
(
false
)
end
it
'does not flush any conditional caches'
do
...
...
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