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
dbffaaa9
Commit
dbffaaa9
authored
Jun 06, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Blob#load_all_data! doesn’t need an argument
parent
fc1090d9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
13 deletions
+15
-13
blob_controller.rb
app/controllers/projects/blob_controller.rb
+3
-3
blob.rb
app/models/blob.rb
+4
-0
server_side.rb
app/models/blob_viewer/server_side.rb
+1
-3
repository.rb
app/models/repository.rb
+1
-1
_text.html.haml
app/views/projects/diffs/viewers/_text.html.haml
+1
-1
files.rb
lib/api/files.rb
+1
-1
files.rb
lib/api/v3/files.rb
+1
-1
blame.rb
lib/gitlab/blame.rb
+1
-1
highlight.rb
lib/gitlab/highlight.rb
+1
-1
git_http_spec.rb
spec/requests/git_http_spec.rb
+1
-1
No files found.
app/controllers/projects/blob_controller.rb
View file @
dbffaaa9
...
...
@@ -55,7 +55,7 @@ class Projects::BlobController < Projects::ApplicationController
def
edit
if
can_collaborate_with_project?
blob
.
load_all_data!
(
@repository
)
blob
.
load_all_data!
else
redirect_to
action:
'show'
end
...
...
@@ -74,7 +74,7 @@ class Projects::BlobController < Projects::ApplicationController
def
preview
@content
=
params
[
:content
]
@blob
.
load_all_data!
(
@repository
)
@blob
.
load_all_data!
diffy
=
Diffy
::
Diff
.
new
(
@blob
.
data
,
@content
,
diff:
'-U 3'
,
include_diff_info:
true
)
diff_lines
=
diffy
.
diff
.
scan
(
/.*\n/
)[
2
..-
1
]
diff_lines
=
Gitlab
::
Diff
::
Parser
.
new
.
parse
(
diff_lines
)
...
...
@@ -111,7 +111,7 @@ class Projects::BlobController < Projects::ApplicationController
private
def
blob
@blob
||=
Blob
.
decorate
(
@repository
.
blob_at
(
@commit
.
id
,
@path
),
@project
)
@blob
||=
@repository
.
blob_at
(
@commit
.
id
,
@path
)
if
@blob
@blob
...
...
app/models/blob.rb
View file @
dbffaaa9
...
...
@@ -94,6 +94,10 @@ class Blob < SimpleDelegator
end
end
def
load_all_data!
super
(
project
.
repository
)
if
project
end
def
no_highlighting?
raw_size
&&
raw_size
>
MAXIMUM_TEXT_HIGHLIGHT_SIZE
end
...
...
app/models/blob_viewer/server_side.rb
View file @
dbffaaa9
...
...
@@ -9,9 +9,7 @@ module BlobViewer
end
def
prepare!
if
blob
.
project
blob
.
load_all_data!
(
blob
.
project
.
repository
)
end
blob
.
load_all_data!
end
def
render_error
...
...
app/models/repository.rb
View file @
dbffaaa9
...
...
@@ -1102,7 +1102,7 @@ class Repository
blob
=
blob_at
(
sha
,
path
)
return
unless
blob
blob
.
load_all_data!
(
self
)
blob
.
load_all_data!
blob
.
data
end
...
...
app/views/projects/diffs/viewers/_text.html.haml
View file @
dbffaaa9
-
blob
=
diff_file
.
blob
-
blob
.
load_all_data!
(
diff_file
.
repository
)
-
blob
.
load_all_data!
-
total_lines
=
blob
.
lines
.
size
-
total_lines
-=
1
if
total_lines
>
0
&&
blob
.
lines
.
last
.
blank?
-
if
diff_view
==
:parallel
...
...
lib/api/files.rb
View file @
dbffaaa9
...
...
@@ -25,7 +25,7 @@ module API
@blob
=
@repo
.
blob_at
(
@commit
.
sha
,
params
[
:file_path
])
not_found!
(
'File'
)
unless
@blob
@blob
.
load_all_data!
(
@repo
)
@blob
.
load_all_data!
end
def
commit_response
(
attrs
)
...
...
lib/api/v3/files.rb
View file @
dbffaaa9
...
...
@@ -56,7 +56,7 @@ module API
blob
=
repo
.
blob_at
(
commit
.
sha
,
params
[
:file_path
])
not_found!
(
'File'
)
unless
blob
blob
.
load_all_data!
(
repo
)
blob
.
load_all_data!
status
(
200
)
{
...
...
lib/gitlab/blame.rb
View file @
dbffaaa9
...
...
@@ -40,7 +40,7 @@ module Gitlab
end
def
highlighted_lines
@blob
.
load_all_data!
(
repository
)
@blob
.
load_all_data!
@highlighted_lines
||=
Gitlab
::
Highlight
.
highlight
(
@blob
.
path
,
@blob
.
data
,
repository:
repository
).
lines
end
...
...
lib/gitlab/highlight.rb
View file @
dbffaaa9
...
...
@@ -9,7 +9,7 @@ module Gitlab
blob
=
repository
.
blob_at
(
ref
,
file_name
)
return
[]
unless
blob
blob
.
load_all_data!
(
repository
)
blob
.
load_all_data!
highlight
(
file_name
,
blob
.
data
,
repository:
repository
).
lines
.
map!
(
&
:html_safe
)
end
...
...
spec/requests/git_http_spec.rb
View file @
dbffaaa9
...
...
@@ -648,7 +648,7 @@ describe 'Git HTTP requests', lib: true do
# Provide a dummy file in its place
allow_any_instance_of
(
Repository
).
to
receive
(
:blob_at
).
and_call_original
allow_any_instance_of
(
Repository
).
to
receive
(
:blob_at
).
with
(
'b83d6e391c22777fca1ed3012fce84f633d7fed0'
,
'info/refs'
)
do
Gitlab
::
Git
::
Blob
.
find
(
project
.
repository
,
'master'
,
'bar/branch-test.txt'
)
Blob
.
decorate
(
Gitlab
::
Git
::
Blob
.
find
(
project
.
repository
,
'master'
,
'bar/branch-test.txt'
),
project
)
end
get
"/
#{
project
.
path_with_namespace
}
/blob/master/info/refs"
...
...
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