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
37881a8e
Commit
37881a8e
authored
Jul 30, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove-redundant-blob-text-calls' into 'master'
Improve diff performance by eliminating redundant checks for text blobs See merge request !5575
parents
6ad514d0
48ff40a0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
6 deletions
+27
-6
CHANGELOG
CHANGELOG
+1
-0
blob_helper.rb
app/helpers/blob_helper.rb
+1
-1
_actions.html.haml
app/views/projects/blob/_actions.html.haml
+2
-1
_file.html.haml
app/views/projects/diffs/_file.html.haml
+5
-4
blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+18
-0
No files found.
CHANGELOG
View file @
37881a8e
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.11.0 (unreleased)
v 8.11.0 (unreleased)
- Fix the title of the toggle dropdown button. !5515 (herminiotorres)
- Fix the title of the toggle dropdown button. !5515 (herminiotorres)
- Improve diff performance by eliminating redundant checks for text blobs
- Remove magic comments (`# encoding: UTF-8`) from Ruby files. !5456 (winniehell)
- Remove magic comments (`# encoding: UTF-8`) from Ruby files. !5456 (winniehell)
- Fix CI status icon link underline (ClemMakesApps)
- Fix CI status icon link underline (ClemMakesApps)
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
...
...
app/helpers/blob_helper.rb
View file @
37881a8e
...
@@ -13,7 +13,7 @@ module BlobHelper
...
@@ -13,7 +13,7 @@ module BlobHelper
blob
=
project
.
repository
.
blob_at
(
ref
,
path
)
rescue
nil
blob
=
project
.
repository
.
blob_at
(
ref
,
path
)
rescue
nil
return
unless
blob
&&
blob_text_viewable?
(
blob
)
return
unless
blob
from_mr
=
options
[
:from_merge_request_id
]
from_mr
=
options
[
:from_merge_request_id
]
link_opts
=
{}
link_opts
=
{}
...
...
app/views/projects/blob/_actions.html.haml
View file @
37881a8e
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
-
if
current_user
-
if
current_user
.btn-group
{
role:
"group"
}
.btn-group
{
role:
"group"
}
=
edit_blob_link
-
if
blob_text_viewable?
(
@blob
)
=
edit_blob_link
=
replace_blob_link
=
replace_blob_link
=
delete_blob_link
=
delete_blob_link
app/views/projects/diffs/_file.html.haml
View file @
37881a8e
...
@@ -9,10 +9,11 @@
...
@@ -9,10 +9,11 @@
=
icon
(
'comment'
)
=
icon
(
'comment'
)
\
\
-
if
editable_diff?
(
diff_file
)
-
if
editable_diff?
(
diff_file
)
=
edit_blob_link
(
@merge_request
.
source_project
,
=
edit_blob_link
(
@merge_request
.
source_project
,
@merge_request
.
source_branch
,
diff_file
.
new_path
,
@merge_request
.
source_branch
,
diff_file
.
new_path
,
from_merge_request_id:
@merge_request
.
id
)
from_merge_request_id:
@merge_request
.
id
,
skip_visible_check:
true
)
=
view_file_btn
(
diff_commit
.
id
,
diff_file
,
project
)
=
view_file_btn
(
diff_commit
.
id
,
diff_file
,
project
)
...
...
spec/helpers/blob_helper_spec.rb
View file @
37881a8e
require
'spec_helper'
require
'spec_helper'
describe
BlobHelper
do
describe
BlobHelper
do
include
TreeHelper
let
(
:blob_name
)
{
'test.lisp'
}
let
(
:blob_name
)
{
'test.lisp'
}
let
(
:no_context_content
)
{
":type
\"
assem
\"
))"
}
let
(
:no_context_content
)
{
":type
\"
assem
\"
))"
}
let
(
:blob_content
)
{
"(make-pathname :defaults name
\n
#{
no_context_content
}
"
}
let
(
:blob_content
)
{
"(make-pathname :defaults name
\n
#{
no_context_content
}
"
}
...
@@ -65,4 +67,20 @@ describe BlobHelper do
...
@@ -65,4 +67,20 @@ describe BlobHelper do
expect
(
sanitize_svg
(
blob
).
data
).
to
eq
(
expected
)
expect
(
sanitize_svg
(
blob
).
data
).
to
eq
(
expected
)
end
end
end
end
describe
"#edit_blob_link"
do
let
(
:project
)
{
create
(
:project
)
}
before
do
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
double
)
end
it
'verifies blob is text'
do
expect
(
self
).
not_to
receive
(
:blob_text_viewable?
)
button
=
edit_blob_link
(
project
,
'refs/heads/master'
,
'README.md'
)
expect
(
button
).
to
start_with
(
'<button'
)
end
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