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
Tatuya Kamada
gitlab-ce
Commits
cd688a60
Commit
cd688a60
authored
Oct 19, 2014
by
Ciro Santilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace regex methods by string ones since faster
and more readable.
parent
c8bb1716
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
21 additions
and
21 deletions
+21
-21
app/models/commit.rb
app/models/commit.rb
+4
-4
app/models/project_services/campfire_service.rb
app/models/project_services/campfire_service.rb
+2
-2
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+2
-2
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+2
-2
app/models/project_services/slack_message.rb
app/models/project_services/slack_message.rb
+2
-2
app/models/user.rb
app/models/user.rb
+1
-1
app/services/git_push_service.rb
app/services/git_push_service.rb
+4
-4
app/services/notification_service.rb
app/services/notification_service.rb
+1
-1
lib/api/internal.rb
lib/api/internal.rb
+2
-2
lib/tasks/gitlab/import.rake
lib/tasks/gitlab/import.rake
+1
-1
No files found.
app/models/commit.rb
View file @
cd688a60
...
...
@@ -75,11 +75,11 @@ class Commit
return
no_commit_message
if
title
.
blank?
title_end
=
title
.
index
(
/\n/
)
title_end
=
title
.
index
(
"
\n
"
)
if
(
!
title_end
&&
title
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
title
[
0
..
79
]
<<
"…"
.
html_safe
else
title
.
split
(
/\n/
,
2
).
first
title
.
split
(
"
\n
"
,
2
).
first
end
end
...
...
@@ -87,11 +87,11 @@ class Commit
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def
description
title_end
=
safe_message
.
index
(
/\n/
)
title_end
=
safe_message
.
index
(
"
\n
"
)
@description
||=
if
(
!
title_end
&&
safe_message
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
"…"
.
html_safe
<<
safe_message
[
80
..-
1
]
else
safe_message
.
split
(
/\n/
,
2
)[
1
].
try
(
:chomp
)
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
end
end
...
...
app/models/project_services/campfire_service.rb
View file @
cd688a60
...
...
@@ -60,9 +60,9 @@ class CampfireService < Service
message
<<
"[
#{
project
.
name_with_namespace
}
] "
message
<<
"
#{
push
[
:user_name
]
}
"
if
before
=~
/000000/
if
before
.
include?
(
'000000'
)
message
<<
"pushed new branch
#{
ref
}
\n
"
elsif
after
=~
/000000/
elsif
after
.
include?
(
'000000'
)
message
<<
"removed branch
#{
ref
}
\n
"
else
message
<<
"pushed
#{
push
[
:total_commits_count
]
}
commits to
#{
ref
}
. "
...
...
app/models/project_services/hipchat_service.rb
View file @
cd688a60
...
...
@@ -58,12 +58,12 @@ class HipchatService < Service
message
=
""
message
<<
"
#{
push
[
:user_name
]
}
"
if
before
=~
/000000/
if
before
.
include?
(
'000000'
)
message
<<
"pushed new branch <a href=
\"
"
\
"
#{
project
.
web_url
}
/commits/
#{
URI
.
escape
(
ref
)
}
\"
>
#{
ref
}
</a>"
\
" to <a href=
\"
#{
project
.
web_url
}
\"
>"
\
"
#{
project
.
name_with_namespace
.
gsub!
(
/\s/
,
""
)
}
</a>
\n
"
elsif
after
=~
/000000/
elsif
after
.
include?
(
'000000'
)
message
<<
"removed branch
#{
ref
}
from <a href=
\"
#{
project
.
web_url
}
\"
>
#{
project
.
name_with_namespace
.
gsub!
(
/\s/
,
''
)
}
</a>
\n
"
else
message
<<
"pushed to branch <a href=
\"
"
\
...
...
app/models/project_services/pushover_service.rb
View file @
cd688a60
...
...
@@ -80,9 +80,9 @@ class PushoverService < Service
before
=
push_data
[
:before
]
after
=
push_data
[
:after
]
if
before
=~
/000000/
if
before
.
include?
(
'000000'
)
message
=
"
#{
push_data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
elsif
after
=~
/000000/
elsif
after
.
include?
(
'000000'
)
message
=
"
#{
push_data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
else
message
=
"
#{
push_data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
...
...
app/models/project_services/slack_message.rb
View file @
cd688a60
...
...
@@ -77,11 +77,11 @@ class SlackMessage
end
def
new_branch?
before
=~
/000000/
before
.
include?
(
'000000'
)
end
def
removed_branch?
after
=~
/000000/
after
.
include?
(
'000000'
)
end
def
branch_url
...
...
app/models/user.rb
View file @
cd688a60
...
...
@@ -487,7 +487,7 @@ class User < ActiveRecord::Base
end
def
temp_oauth_email?
email
=~
/\Atemp-email-for-oauth/
email
.
start_with?
(
'temp-email-for-oauth'
)
end
def
public_profile?
...
...
app/services/git_push_service.rb
View file @
cd688a60
...
...
@@ -170,23 +170,23 @@ class GitPushService
ref_parts
=
ref
.
split
(
'/'
)
# Return if this is not a push to a branch (e.g. new commits)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
ref_parts
[
1
]
.
include?
(
'heads'
)
&&
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
end
def
push_to_new_branch?
(
ref
,
oldrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
==
Gitlab
::
Git
::
BLANK_SHA
ref_parts
[
1
]
.
include?
(
'heads'
)
&&
oldrev
==
Gitlab
::
Git
::
BLANK_SHA
end
def
push_remove_branch?
(
ref
,
newrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
newrev
==
Gitlab
::
Git
::
BLANK_SHA
ref_parts
[
1
]
.
include?
(
'heads'
)
&&
newrev
==
Gitlab
::
Git
::
BLANK_SHA
end
def
push_to_branch?
(
ref
)
ref
=~
/refs\/heads/
ref
.
include?
(
'refs/heads'
)
end
def
is_default_branch?
(
ref
)
...
...
app/services/notification_service.rb
View file @
cd688a60
...
...
@@ -118,7 +118,7 @@ class NotificationService
return
true
unless
note
.
noteable_type
.
present?
# ignore gitlab service messages
return
true
if
note
.
note
=~
/\A_Status changed to closed_/
return
true
if
note
.
note
.
start_with?
(
'_Status changed to closed_'
)
return
true
if
note
.
cross_reference?
&&
note
.
system
==
true
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
...
...
lib/api/internal.rb
View file @
cd688a60
...
...
@@ -25,8 +25,8 @@ module API
# project. This applies the correct project permissions to
# the wiki repository as well.
access
=
if
project_path
=~
/\.wiki\Z/
project_path
.
sub!
(
/\.wiki\Z/
,
'
'
)
if
project_path
.
end_with?
(
'.wiki'
)
project_path
.
chomp!
(
'.wiki
'
)
Gitlab
::
GitAccessWiki
.
new
else
Gitlab
::
GitAccess
.
new
...
...
lib/tasks/gitlab/import.rake
View file @
cd688a60
...
...
@@ -25,7 +25,7 @@ namespace :gitlab do
puts
"Processing
#{
repo_path
}
"
.
yellow
if
path
=~
/\.wiki\Z/
if
path
.
end_with?
(
'.wiki'
)
puts
" * Skipping wiki repo"
next
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