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
Jérome Perrin
gitlab-ce
Commits
9f45e229
Commit
9f45e229
authored
Oct 03, 2014
by
Robert Schilling
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7858 from cirosantilli/def-param-paren
Add parenthesis to function def with arguments.
parents
a3d90c50
2e9f5de8
Changes
33
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
67 additions
and
67 deletions
+67
-67
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+2
-2
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+1
-1
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+2
-2
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+2
-2
app/helpers/profile_helper.rb
app/helpers/profile_helper.rb
+1
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-2
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+1
-1
app/helpers/tags_helper.rb
app/helpers/tags_helper.rb
+2
-2
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+1
-1
app/models/ability.rb
app/models/ability.rb
+2
-2
app/models/commit.rb
app/models/commit.rb
+1
-1
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+5
-5
app/models/members/project_member.rb
app/models/members/project_member.rb
+1
-1
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/models/network/graph.rb
app/models/network/graph.rb
+1
-1
app/models/project.rb
app/models/project.rb
+2
-2
app/models/project_services/gitlab_ci_service.rb
app/models/project_services/gitlab_ci_service.rb
+2
-2
app/models/project_team.rb
app/models/project_team.rb
+1
-1
app/models/user.rb
app/models/user.rb
+7
-7
app/services/base_service.rb
app/services/base_service.rb
+1
-1
app/services/git_push_service.rb
app/services/git_push_service.rb
+7
-7
app/workers/repository_import_worker.rb
app/workers/repository_import_worker.rb
+1
-1
features/steps/group.rb
features/steps/group.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
lib/event_filter.rb
lib/event_filter.rb
+4
-4
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+1
-1
lib/gitlab/diff/parser.rb
lib/gitlab/diff/parser.rb
+1
-1
lib/gitlab/inline_diff.rb
lib/gitlab/inline_diff.rb
+3
-3
lib/gitlab/logger.rb
lib/gitlab/logger.rb
+1
-1
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+6
-6
lib/gitlab/satellite/satellite.rb
lib/gitlab/satellite/satellite.rb
+1
-1
spec/lib/gitlab/satellite/action_spec.rb
spec/lib/gitlab/satellite/action_spec.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
9f45e229
...
@@ -62,7 +62,7 @@ class ApplicationController < ActionController::Base
...
@@ -62,7 +62,7 @@ class ApplicationController < ActionController::Base
end
end
end
end
def
after_sign_in_path_for
resource
def
after_sign_in_path_for
(
resource
)
if
resource
.
is_a?
(
User
)
&&
resource
.
respond_to?
(
:blocked?
)
&&
resource
.
blocked?
if
resource
.
is_a?
(
User
)
&&
resource
.
respond_to?
(
:blocked?
)
&&
resource
.
blocked?
sign_out
resource
sign_out
resource
flash
[
:alert
]
=
"Your account is blocked. Retry when an admin has unblocked it."
flash
[
:alert
]
=
"Your account is blocked. Retry when an admin has unblocked it."
...
...
app/controllers/registrations_controller.rb
View file @
9f45e229
...
@@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController
...
@@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController
super
super
end
end
def
after_sign_up_path_for
resource
def
after_sign_up_path_for
(
resource
)
new_user_session_path
new_user_session_path
end
end
def
after_inactive_sign_up_path_for
resource
def
after_inactive_sign_up_path_for
(
resource
)
new_user_session_path
new_user_session_path
end
end
...
...
app/helpers/events_helper.rb
View file @
9f45e229
...
@@ -19,7 +19,7 @@ module EventsHelper
...
@@ -19,7 +19,7 @@ module EventsHelper
[
event
.
action_name
,
target
].
join
(
" "
)
[
event
.
action_name
,
target
].
join
(
" "
)
end
end
def
event_filter_link
key
,
tooltip
def
event_filter_link
(
key
,
tooltip
)
key
=
key
.
to_s
key
=
key
.
to_s
inactive
=
if
@event_filter
.
active?
key
inactive
=
if
@event_filter
.
active?
key
nil
nil
...
...
app/helpers/issues_helper.rb
View file @
9f45e229
module
IssuesHelper
module
IssuesHelper
def
issue_css_classes
issue
def
issue_css_classes
(
issue
)
classes
=
"issue"
classes
=
"issue"
classes
<<
" closed"
if
issue
.
closed?
classes
<<
" closed"
if
issue
.
closed?
classes
<<
" today"
if
issue
.
today?
classes
<<
" today"
if
issue
.
today?
...
@@ -84,7 +84,7 @@ module IssuesHelper
...
@@ -84,7 +84,7 @@ module IssuesHelper
'id'
,
'name'
,
object
.
assignee_id
)
'id'
,
'name'
,
object
.
assignee_id
)
end
end
def
milestone_options
object
def
milestone_options
(
object
)
options_from_collection_for_select
(
object
.
project
.
milestones
.
active
,
options_from_collection_for_select
(
object
.
project
.
milestones
.
active
,
'id'
,
'title'
,
object
.
milestone_id
)
'id'
,
'title'
,
object
.
milestone_id
)
end
end
...
...
app/helpers/merge_requests_helper.rb
View file @
9f45e229
...
@@ -24,14 +24,14 @@ module MergeRequestsHelper
...
@@ -24,14 +24,14 @@ module MergeRequestsHelper
}
}
end
end
def
mr_css_classes
mr
def
mr_css_classes
(
mr
)
classes
=
"merge-request"
classes
=
"merge-request"
classes
<<
" closed"
if
mr
.
closed?
classes
<<
" closed"
if
mr
.
closed?
classes
<<
" merged"
if
mr
.
merged?
classes
<<
" merged"
if
mr
.
merged?
classes
classes
end
end
def
ci_build_details_path
merge_request
def
ci_build_details_path
(
merge_request
)
merge_request
.
source_project
.
ci_service
.
build_page
(
merge_request
.
last_commit
.
sha
)
merge_request
.
source_project
.
ci_service
.
build_page
(
merge_request
.
last_commit
.
sha
)
end
end
...
...
app/helpers/profile_helper.rb
View file @
9f45e229
module
ProfileHelper
module
ProfileHelper
def
oauth_active_class
provider
def
oauth_active_class
(
provider
)
if
current_user
.
provider
==
provider
.
to_s
if
current_user
.
provider
==
provider
.
to_s
'active'
'active'
end
end
...
...
app/helpers/projects_helper.rb
View file @
9f45e229
...
@@ -3,7 +3,7 @@ module ProjectsHelper
...
@@ -3,7 +3,7 @@ module ProjectsHelper
"You are going to remove
#{
user
.
name
}
from
#{
project
.
name
}
project team. Are you sure?"
"You are going to remove
#{
user
.
name
}
from
#{
project
.
name
}
project team. Are you sure?"
end
end
def
link_to_project
project
def
link_to_project
(
project
)
link_to
project
do
link_to
project
do
title
=
content_tag
(
:span
,
project
.
name
,
class:
'project-name'
)
title
=
content_tag
(
:span
,
project
.
name
,
class:
'project-name'
)
...
@@ -39,7 +39,7 @@ module ProjectsHelper
...
@@ -39,7 +39,7 @@ module ProjectsHelper
end
end
end
end
def
project_title
project
def
project_title
(
project
)
if
project
.
group
if
project
.
group
content_tag
:span
do
content_tag
:span
do
link_to
(
simple_sanitize
(
project
.
group
.
name
),
group_path
(
project
.
group
))
+
" / "
+
project
.
name
link_to
(
simple_sanitize
(
project
.
group
.
name
),
group_path
(
project
.
group
))
+
" / "
+
project
.
name
...
...
app/helpers/tab_helper.rb
View file @
9f45e229
...
@@ -89,7 +89,7 @@ module TabHelper
...
@@ -89,7 +89,7 @@ module TabHelper
end
end
# Use nav_tab for save controller/action but different params
# Use nav_tab for save controller/action but different params
def
nav_tab
key
,
value
,
&
block
def
nav_tab
(
key
,
value
,
&
block
)
o
=
{}
o
=
{}
o
[
:class
]
=
""
o
[
:class
]
=
""
...
...
app/helpers/tags_helper.rb
View file @
9f45e229
module
TagsHelper
module
TagsHelper
def
tag_path
tag
def
tag_path
(
tag
)
"/tags/
#{
tag
}
"
"/tags/
#{
tag
}
"
end
end
def
tag_list
project
def
tag_list
(
project
)
html
=
''
html
=
''
project
.
tag_list
.
each
do
|
tag
|
project
.
tag_list
.
each
do
|
tag
|
html
+=
link_to
tag
,
tag_path
(
tag
)
html
+=
link_to
tag
,
tag_path
(
tag
)
...
...
app/helpers/tree_helper.rb
View file @
9f45e229
...
@@ -80,7 +80,7 @@ module TreeHelper
...
@@ -80,7 +80,7 @@ module TreeHelper
end
end
end
end
def
up_dir_path
tree
def
up_dir_path
(
tree
)
file
=
File
.
join
(
@path
,
".."
)
file
=
File
.
join
(
@path
,
".."
)
tree_join
(
@ref
,
file
)
tree_join
(
@ref
,
file
)
end
end
...
...
app/models/ability.rb
View file @
9f45e229
...
@@ -184,7 +184,7 @@ class Ability
...
@@ -184,7 +184,7 @@ class Ability
]
]
end
end
def
group_abilities
user
,
group
def
group_abilities
(
user
,
group
)
rules
=
[]
rules
=
[]
if
user
.
admin?
||
group
.
users
.
include?
(
user
)
||
ProjectsFinder
.
new
.
execute
(
user
,
group:
group
).
any?
if
user
.
admin?
||
group
.
users
.
include?
(
user
)
||
ProjectsFinder
.
new
.
execute
(
user
,
group:
group
).
any?
...
@@ -209,7 +209,7 @@ class Ability
...
@@ -209,7 +209,7 @@ class Ability
rules
.
flatten
rules
.
flatten
end
end
def
namespace_abilities
user
,
namespace
def
namespace_abilities
(
user
,
namespace
)
rules
=
[]
rules
=
[]
# Only namespace owner and administrators can manage it
# Only namespace owner and administrators can manage it
...
...
app/models/commit.rb
View file @
9f45e229
...
@@ -90,7 +90,7 @@ class Commit
...
@@ -90,7 +90,7 @@ class Commit
# Discover issues should be closed when this commit is pushed to a project's
# Discover issues should be closed when this commit is pushed to a project's
# default branch.
# default branch.
def
closes_issues
project
def
closes_issues
(
project
)
Gitlab
::
ClosingIssueExtractor
.
closed_by_message_in_project
(
safe_message
,
project
)
Gitlab
::
ClosingIssueExtractor
.
closed_by_message_in_project
(
safe_message
,
project
)
end
end
...
...
app/models/concerns/mentionable.rb
View file @
9f45e229
...
@@ -10,7 +10,7 @@ module Mentionable
...
@@ -10,7 +10,7 @@ module Mentionable
module
ClassMethods
module
ClassMethods
# Indicate which attributes of the Mentionable to search for GFM references.
# Indicate which attributes of the Mentionable to search for GFM references.
def
attr_mentionable
*
attrs
def
attr_mentionable
(
*
attrs
)
mentionable_attrs
.
concat
(
attrs
.
map
(
&
:to_s
))
mentionable_attrs
.
concat
(
attrs
.
map
(
&
:to_s
))
end
end
...
@@ -38,7 +38,7 @@ module Mentionable
...
@@ -38,7 +38,7 @@ module Mentionable
# Determine whether or not a cross-reference Note has already been created between this Mentionable and
# Determine whether or not a cross-reference Note has already been created between this Mentionable and
# the specified target.
# the specified target.
def
has_mentioned?
target
def
has_mentioned?
(
target
)
Note
.
cross_reference_exists?
(
target
,
local_reference
)
Note
.
cross_reference_exists?
(
target
,
local_reference
)
end
end
...
@@ -64,7 +64,7 @@ module Mentionable
...
@@ -64,7 +64,7 @@ module Mentionable
end
end
# Extract GFM references to other Mentionables from this Mentionable. Always excludes its #local_reference.
# Extract GFM references to other Mentionables from this Mentionable. Always excludes its #local_reference.
def
references
p
=
project
,
text
=
mentionable_text
def
references
(
p
=
project
,
text
=
mentionable_text
)
return
[]
if
text
.
blank?
return
[]
if
text
.
blank?
ext
=
Gitlab
::
ReferenceExtractor
.
new
ext
=
Gitlab
::
ReferenceExtractor
.
new
ext
.
analyze
(
text
)
ext
.
analyze
(
text
)
...
@@ -72,7 +72,7 @@ module Mentionable
...
@@ -72,7 +72,7 @@ module Mentionable
end
end
# Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+.
# Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+.
def
create_cross_references!
p
=
project
,
a
=
author
,
without
=
[]
def
create_cross_references!
(
p
=
project
,
a
=
author
,
without
=
[])
refs
=
references
(
p
)
-
without
refs
=
references
(
p
)
-
without
refs
.
each
do
|
ref
|
refs
.
each
do
|
ref
|
Note
.
create_cross_reference_note
(
ref
,
local_reference
,
a
,
p
)
Note
.
create_cross_reference_note
(
ref
,
local_reference
,
a
,
p
)
...
@@ -81,7 +81,7 @@ module Mentionable
...
@@ -81,7 +81,7 @@ module Mentionable
# If the mentionable_text field is about to change, locate any *added* references and create cross references for
# If the mentionable_text field is about to change, locate any *added* references and create cross references for
# them. Invoke from an observer's #before_save implementation.
# them. Invoke from an observer's #before_save implementation.
def
notice_added_references
p
=
project
,
a
=
author
def
notice_added_references
(
p
=
project
,
a
=
author
)
ch
=
changed_attributes
ch
=
changed_attributes
original
,
mentionable_changed
=
""
,
false
original
,
mentionable_changed
=
""
,
false
self
.
class
.
mentionable_attrs
.
each
do
|
attr
|
self
.
class
.
mentionable_attrs
.
each
do
|
attr
|
...
...
app/models/members/project_member.rb
View file @
9f45e229
...
@@ -77,7 +77,7 @@ class ProjectMember < Member
...
@@ -77,7 +77,7 @@ class ProjectMember < Member
false
false
end
end
def
truncate_team
project
def
truncate_team
(
project
)
truncate_teams
[
project
.
id
]
truncate_teams
[
project
.
id
]
end
end
...
...
app/models/namespace.rb
View file @
9f45e229
...
@@ -38,7 +38,7 @@ class Namespace < ActiveRecord::Base
...
@@ -38,7 +38,7 @@ class Namespace < ActiveRecord::Base
scope
:root
,
->
{
where
(
'type IS NULL'
)
}
scope
:root
,
->
{
where
(
'type IS NULL'
)
}
def
self
.
search
query
def
self
.
search
(
query
)
where
(
"name LIKE :query OR path LIKE :query"
,
query:
"%
#{
query
}
%"
)
where
(
"name LIKE :query OR path LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
end
...
...
app/models/network/graph.rb
View file @
9f45e229
...
@@ -6,7 +6,7 @@ module Network
...
@@ -6,7 +6,7 @@ module Network
@max_count
||=
650
@max_count
||=
650
end
end
def
initialize
project
,
ref
,
commit
,
filter_ref
def
initialize
(
project
,
ref
,
commit
,
filter_ref
)
@project
=
project
@project
=
project
@ref
=
ref
@ref
=
ref
@commit
=
commit
@commit
=
commit
...
...
app/models/project.rb
View file @
9f45e229
...
@@ -331,7 +331,7 @@ class Project < ActiveRecord::Base
...
@@ -331,7 +331,7 @@ class Project < ActiveRecord::Base
path
path
end
end
def
items_for
entity
def
items_for
(
entity
)
case
entity
case
entity
when
'issue'
then
when
'issue'
then
issues
issues
...
@@ -504,7 +504,7 @@ class Project < ActiveRecord::Base
...
@@ -504,7 +504,7 @@ class Project < ActiveRecord::Base
end
end
# Check if current branch name is marked as protected in the system
# Check if current branch name is marked as protected in the system
def
protected_branch?
branch_name
def
protected_branch?
(
branch_name
)
protected_branches_names
.
include?
(
branch_name
)
protected_branches_names
.
include?
(
branch_name
)
end
end
...
...
app/models/project_services/gitlab_ci_service.rb
View file @
9f45e229
...
@@ -27,7 +27,7 @@ class GitlabCiService < CiService
...
@@ -27,7 +27,7 @@ class GitlabCiService < CiService
hook
.
save
hook
.
save
end
end
def
commit_status_path
sha
def
commit_status_path
(
sha
)
project_url
+
"/builds/
#{
sha
}
/status.json?token=
#{
token
}
"
project_url
+
"/builds/
#{
sha
}
/status.json?token=
#{
token
}
"
end
end
...
@@ -54,7 +54,7 @@ class GitlabCiService < CiService
...
@@ -54,7 +54,7 @@ class GitlabCiService < CiService
end
end
end
end
def
build_page
sha
def
build_page
(
sha
)
project_url
+
"/builds/
#{
sha
}
"
project_url
+
"/builds/
#{
sha
}
"
end
end
...
...
app/models/project_team.rb
View file @
9f45e229
...
@@ -11,7 +11,7 @@ class ProjectTeam
...
@@ -11,7 +11,7 @@ class ProjectTeam
# @team << [@user, :master]
# @team << [@user, :master]
# @team << [@users, :master]
# @team << [@users, :master]
#
#
def
<<
args
def
<<
(
args
)
users
=
args
.
first
users
=
args
.
first
if
users
.
respond_to?
(
:each
)
if
users
.
respond_to?
(
:each
)
...
...
app/models/user.rb
View file @
9f45e229
...
@@ -203,7 +203,7 @@ class User < ActiveRecord::Base
...
@@ -203,7 +203,7 @@ class User < ActiveRecord::Base
User
.
where
(
name:
name
).
first
User
.
where
(
name:
name
).
first
end
end
def
filter
filter_name
def
filter
(
filter_name
)
case
filter_name
case
filter_name
when
"admins"
;
self
.
admins
when
"admins"
;
self
.
admins
when
"blocked"
;
self
.
blocked
when
"blocked"
;
self
.
blocked
...
@@ -213,7 +213,7 @@ class User < ActiveRecord::Base
...
@@ -213,7 +213,7 @@ class User < ActiveRecord::Base
end
end
end
end
def
search
query
def
search
(
query
)
where
(
"lower(name) LIKE :query OR lower(email) LIKE :query OR lower(username) LIKE :query"
,
query:
"%
#{
query
.
downcase
}
%"
)
where
(
"lower(name) LIKE :query OR lower(email) LIKE :query OR lower(username) LIKE :query"
,
query:
"%
#{
query
.
downcase
}
%"
)
end
end
...
@@ -332,7 +332,7 @@ class User < ActiveRecord::Base
...
@@ -332,7 +332,7 @@ class User < ActiveRecord::Base
several_namespaces?
||
admin
several_namespaces?
||
admin
end
end
def
can?
action
,
subject
def
can?
(
action
,
subject
)
abilities
.
allowed?
(
self
,
action
,
subject
)
abilities
.
allowed?
(
self
,
action
,
subject
)
end
end
...
@@ -353,7 +353,7 @@ class User < ActiveRecord::Base
...
@@ -353,7 +353,7 @@ class User < ActiveRecord::Base
(
personal_projects
.
count
.
to_f
/
projects_limit
)
*
100
(
personal_projects
.
count
.
to_f
/
projects_limit
)
*
100
end
end
def
recent_push
project_id
=
nil
def
recent_push
(
project_id
=
nil
)
# Get push events not earlier than 2 hours ago
# Get push events not earlier than 2 hours ago
events
=
recent_events
.
code_push
.
where
(
"created_at > ?"
,
Time
.
now
-
2
.
hours
)
events
=
recent_events
.
code_push
.
where
(
"created_at > ?"
,
Time
.
now
-
2
.
hours
)
events
=
events
.
where
(
project_id:
project_id
)
if
project_id
events
=
events
.
where
(
project_id:
project_id
)
if
project_id
...
@@ -382,11 +382,11 @@ class User < ActiveRecord::Base
...
@@ -382,11 +382,11 @@ class User < ActiveRecord::Base
project
.
team_member_by_id
(
self
.
id
)
project
.
team_member_by_id
(
self
.
id
)
end
end
def
already_forked?
project
def
already_forked?
(
project
)
!!
fork_of
(
project
)
!!
fork_of
(
project
)
end
end
def
fork_of
project
def
fork_of
(
project
)
links
=
ForkedProjectLink
.
where
(
forked_from_project_id:
project
,
forked_to_project_id:
personal_projects
)
links
=
ForkedProjectLink
.
where
(
forked_from_project_id:
project
,
forked_to_project_id:
personal_projects
)
if
links
.
any?
if
links
.
any?
...
@@ -512,7 +512,7 @@ class User < ActiveRecord::Base
...
@@ -512,7 +512,7 @@ class User < ActiveRecord::Base
NotificationService
.
new
NotificationService
.
new
end
end
def
log_info
message
def
log_info
(
message
)
Gitlab
::
AppLogger
.
info
message
Gitlab
::
AppLogger
.
info
message
end
end
...
...
app/services/base_service.rb
View file @
9f45e229
...
@@ -25,7 +25,7 @@ class BaseService
...
@@ -25,7 +25,7 @@ class BaseService
EventCreateService
.
new
EventCreateService
.
new
end
end
def
log_info
message
def
log_info
(
message
)
Gitlab
::
AppLogger
.
info
message
Gitlab
::
AppLogger
.
info
message
end
end
...
...
app/services/git_push_service.rb
View file @
9f45e229
...
@@ -75,7 +75,7 @@ class GitPushService
...
@@ -75,7 +75,7 @@ class GitPushService
# Extract any GFM references from the pushed commit messages. If the configured issue-closing regex is matched,
# Extract any GFM references from the pushed commit messages. If the configured issue-closing regex is matched,
# close the referenced Issue. Create cross-reference Notes corresponding to any other referenced Mentionables.
# close the referenced Issue. Create cross-reference Notes corresponding to any other referenced Mentionables.
def
process_commit_messages
ref
def
process_commit_messages
(
ref
)
is_default_branch
=
is_default_branch?
(
ref
)
is_default_branch
=
is_default_branch?
(
ref
)
@push_commits
.
each
do
|
commit
|
@push_commits
.
each
do
|
commit
|
...
@@ -165,34 +165,34 @@ class GitPushService
...
@@ -165,34 +165,34 @@ class GitPushService
data
data
end
end
def
push_to_existing_branch?
ref
,
oldrev
def
push_to_existing_branch?
(
ref
,
oldrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
# Return if this is not a push to a branch (e.g. new commits)
# Return if this is not a push to a branch (e.g. new commits)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
!=
"0000000000000000000000000000000000000000"
ref_parts
[
1
]
=~
/heads/
&&
oldrev
!=
"0000000000000000000000000000000000000000"
end
end
def
push_to_new_branch?
ref
,
oldrev
def
push_to_new_branch?
(
ref
,
oldrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
==
"0000000000000000000000000000000000000000"
ref_parts
[
1
]
=~
/heads/
&&
oldrev
==
"0000000000000000000000000000000000000000"
end
end
def
push_remove_branch?
ref
,
newrev
def
push_remove_branch?
(
ref
,
newrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
newrev
==
"0000000000000000000000000000000000000000"
ref_parts
[
1
]
=~
/heads/
&&
newrev
==
"0000000000000000000000000000000000000000"
end
end
def
push_to_branch?
ref
def
push_to_branch?
(
ref
)
ref
=~
/refs\/heads/
ref
=~
/refs\/heads/
end
end
def
is_default_branch?
ref
def
is_default_branch?
(
ref
)
ref
==
"refs/heads/
#{
project
.
default_branch
}
"
ref
==
"refs/heads/
#{
project
.
default_branch
}
"
end
end
def
commit_user
commit
def
commit_user
(
commit
)
User
.
find_for_commit
(
commit
.
author_email
,
commit
.
author_name
)
||
user
User
.
find_for_commit
(
commit
.
author_email
,
commit
.
author_name
)
||
user
end
end
end
end
app/workers/repository_import_worker.rb
View file @
9f45e229
features/steps/group.rb
View file @
9f45e229
...
@@ -201,7 +201,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -201,7 +201,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
protected
protected
def
assigned_to_me
key
def
assigned_to_me
(
key
)
project
.
send
(
key
).
where
(
assignee_id:
current_user
.
id
)
project
.
send
(
key
).
where
(
assignee_id:
current_user
.
id
)
end
end
...
...
lib/api/helpers.rb
View file @
9f45e229
...
@@ -71,7 +71,7 @@ module API
...
@@ -71,7 +71,7 @@ module API
forbidden!
unless
current_user
.
is_admin?
forbidden!
unless
current_user
.
is_admin?
end
end
def
authorize!
action
,
subject
def
authorize!
(
action
,
subject
)
unless
abilities
.
allowed?
(
current_user
,
action
,
subject
)
unless
abilities
.
allowed?
(
current_user
,
action
,
subject
)
forbidden!
forbidden!
end
end
...
...
lib/event_filter.rb
View file @
9f45e229
...
@@ -23,7 +23,7 @@ class EventFilter
...
@@ -23,7 +23,7 @@ class EventFilter
end
end
end
end
def
initialize
params
def
initialize
(
params
)
@params
=
if
params
@params
=
if
params
params
.
dup
params
.
dup
else
else
...
@@ -31,7 +31,7 @@ class EventFilter
...
@@ -31,7 +31,7 @@ class EventFilter
end
end
end
end
def
apply_filter
events
def
apply_filter
(
events
)
return
events
unless
params
.
present?
return
events
unless
params
.
present?
filter
=
params
.
dup
filter
=
params
.
dup
...
@@ -50,7 +50,7 @@ class EventFilter
...
@@ -50,7 +50,7 @@ class EventFilter
events
=
events
.
where
(
action:
actions
)
events
=
events
.
where
(
action:
actions
)
end
end
def
options
key
def
options
(
key
)
filter
=
params
.
dup
filter
=
params
.
dup
if
filter
.
include?
key
if
filter
.
include?
key
...
@@ -62,7 +62,7 @@ class EventFilter
...
@@ -62,7 +62,7 @@ class EventFilter
filter
filter
end
end
def
active?
key
def
active?
(
key
)
params
.
include?
key
params
.
include?
key
end
end
end
end
lib/gitlab/backend/shell.rb
View file @
9f45e229
...
@@ -213,7 +213,7 @@ module Gitlab
...
@@ -213,7 +213,7 @@ module Gitlab
FileUtils
.
rm_r
(
satellites_path
,
force:
true
)
FileUtils
.
rm_r
(
satellites_path
,
force:
true
)
end
end
def
url_to_repo
path
def
url_to_repo
(
path
)
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
+
"
#{
path
}
.git"
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
+
"
#{
path
}
.git"
end
end
...
...
lib/gitlab/diff/parser.rb
View file @
9f45e229
...
@@ -72,7 +72,7 @@ module Gitlab
...
@@ -72,7 +72,7 @@ module Gitlab
end
end
end
end
def
html_escape
str
def
html_escape
(
str
)
replacements
=
{
'&'
=>
'&'
,
'>'
=>
'>'
,
'<'
=>
'<'
,
'"'
=>
'"'
,
"'"
=>
'''
}
replacements
=
{
'&'
=>
'&'
,
'>'
=>
'>'
,
'<'
=>
'<'
,
'"'
=>
'"'
,
"'"
=>
'''
}
str
.
gsub
(
/[&"'><]/
,
replacements
)
str
.
gsub
(
/[&"'><]/
,
replacements
)
end
end
...
...
lib/gitlab/inline_diff.rb
View file @
9f45e229
...
@@ -5,7 +5,7 @@ module Gitlab
...
@@ -5,7 +5,7 @@ module Gitlab
START
=
"#!idiff-start!#"
START
=
"#!idiff-start!#"
FINISH
=
"#!idiff-finish!#"
FINISH
=
"#!idiff-finish!#"
def
processing
diff_arr
def
processing
(
diff_arr
)
indexes
=
_indexes_of_changed_lines
diff_arr
indexes
=
_indexes_of_changed_lines
diff_arr
indexes
.
each
do
|
index
|
indexes
.
each
do
|
index
|
...
@@ -52,7 +52,7 @@ module Gitlab
...
@@ -52,7 +52,7 @@ module Gitlab
diff_arr
diff_arr
end
end
def
_indexes_of_changed_lines
diff_arr
def
_indexes_of_changed_lines
(
diff_arr
)
chain_of_first_symbols
=
""
chain_of_first_symbols
=
""
diff_arr
.
each_with_index
do
|
line
,
i
|
diff_arr
.
each_with_index
do
|
line
,
i
|
chain_of_first_symbols
+=
line
[
0
]
chain_of_first_symbols
+=
line
[
0
]
...
@@ -68,7 +68,7 @@ module Gitlab
...
@@ -68,7 +68,7 @@ module Gitlab
indexes
indexes
end
end
def
replace_markers
line
def
replace_markers
(
line
)
line
.
gsub!
(
START
,
"<span class='idiff'>"
)
line
.
gsub!
(
START
,
"<span class='idiff'>"
)
line
.
gsub!
(
FINISH
,
"</span>"
)
line
.
gsub!
(
FINISH
,
"</span>"
)
line
line
...
...
lib/gitlab/logger.rb
View file @
9f45e229
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
tail_output
.
split
(
"
\n
"
)
tail_output
.
split
(
"
\n
"
)
end
end
def
self
.
read_latest_for
filename
def
self
.
read_latest_for
(
filename
)
path
=
Rails
.
root
.
join
(
"log"
,
filename
)
path
=
Rails
.
root
.
join
(
"log"
,
filename
)
tail_output
,
_
=
Gitlab
::
Popen
.
popen
(
%W(tail -n 2000
#{
path
}
)
)
tail_output
,
_
=
Gitlab
::
Popen
.
popen
(
%W(tail -n 2000
#{
path
}
)
)
tail_output
.
split
(
"
\n
"
)
tail_output
.
split
(
"
\n
"
)
...
...
lib/gitlab/reference_extractor.rb
View file @
9f45e229
...
@@ -9,38 +9,38 @@ module Gitlab
...
@@ -9,38 +9,38 @@ module Gitlab
@users
,
@issues
,
@merge_requests
,
@snippets
,
@commits
=
[],
[],
[],
[],
[]
@users
,
@issues
,
@merge_requests
,
@snippets
,
@commits
=
[],
[],
[],
[],
[]
end
end
def
analyze
string
def
analyze
(
string
)
parse_references
(
string
.
dup
)
parse_references
(
string
.
dup
)
end
end
# Given a valid project, resolve the extracted identifiers of the requested type to
# Given a valid project, resolve the extracted identifiers of the requested type to
# model objects.
# model objects.
def
users_for
project
def
users_for
(
project
)
users
.
map
do
|
identifier
|
users
.
map
do
|
identifier
|
project
.
users
.
where
(
username:
identifier
).
first
project
.
users
.
where
(
username:
identifier
).
first
end
.
reject
(
&
:nil?
)
end
.
reject
(
&
:nil?
)
end
end
def
issues_for
project
def
issues_for
(
project
)
issues
.
map
do
|
identifier
|
issues
.
map
do
|
identifier
|
project
.
issues
.
where
(
iid:
identifier
).
first
project
.
issues
.
where
(
iid:
identifier
).
first
end
.
reject
(
&
:nil?
)
end
.
reject
(
&
:nil?
)
end
end
def
merge_requests_for
project
def
merge_requests_for
(
project
)
merge_requests
.
map
do
|
identifier
|
merge_requests
.
map
do
|
identifier
|
project
.
merge_requests
.
where
(
iid:
identifier
).
first
project
.
merge_requests
.
where
(
iid:
identifier
).
first
end
.
reject
(
&
:nil?
)
end
.
reject
(
&
:nil?
)
end
end
def
snippets_for
project
def
snippets_for
(
project
)
snippets
.
map
do
|
identifier
|
snippets
.
map
do
|
identifier
|
project
.
snippets
.
where
(
id:
identifier
).
first
project
.
snippets
.
where
(
id:
identifier
).
first
end
.
reject
(
&
:nil?
)
end
.
reject
(
&
:nil?
)
end
end
def
commits_for
project
def
commits_for
(
project
)
repo
=
project
.
repository
repo
=
project
.
repository
return
[]
if
repo
.
nil?
return
[]
if
repo
.
nil?
...
...
lib/gitlab/satellite/satellite.rb
View file @
9f45e229
...
@@ -11,7 +11,7 @@ module Gitlab
...
@@ -11,7 +11,7 @@ module Gitlab
@project
=
project
@project
=
project
end
end
def
log
message
def
log
(
message
)
Gitlab
::
Satellite
::
Logger
.
error
(
message
)
Gitlab
::
Satellite
::
Logger
.
error
(
message
)
end
end
...
...
spec/lib/gitlab/satellite/action_spec.rb
View file @
9f45e229
...
@@ -97,7 +97,7 @@ describe 'Gitlab::Satellite::Action' do
...
@@ -97,7 +97,7 @@ describe 'Gitlab::Satellite::Action' do
end
end
class
FileLockStatusChecker
<
File
class
FileLockStatusChecker
<
File
def
flocked?
&
block
def
flocked?
(
&
block
)
status
=
flock
LOCK_EX
|
LOCK_NB
status
=
flock
LOCK_EX
|
LOCK_NB
case
status
case
status
when
false
when
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