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
64c8ee47
Commit
64c8ee47
authored
Feb 01, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP lazy blobs
parent
481644ca
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
3 deletions
+15
-3
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+3
-0
app/models/ci/commit.rb
app/models/ci/commit.rb
+5
-1
app/models/tree.rb
app/models/tree.rb
+2
-0
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-0
lib/api/files.rb
lib/api/files.rb
+4
-2
No files found.
app/controllers/projects/blob_controller.rb
View file @
64c8ee47
...
...
@@ -33,6 +33,7 @@ class Projects::BlobController < Projects::ApplicationController
def
edit
@last_commit
=
Gitlab
::
Git
::
Commit
.
last_for_path
(
@repository
,
@ref
,
@path
).
sha
blob
.
load_all_data!
(
@repository
)
end
def
update
...
...
@@ -51,6 +52,7 @@ class Projects::BlobController < Projects::ApplicationController
def
preview
@content
=
params
[
:content
]
@blob
.
load_all_data!
(
@repository
)
diffy
=
Diffy
::
Diff
.
new
(
@blob
.
data
,
@content
,
diff:
'-U 3'
,
include_diff_info:
true
)
@diff_lines
=
Gitlab
::
Diff
::
Parser
.
new
.
parse
(
diffy
.
diff
.
scan
(
/.*\n/
))
...
...
@@ -65,6 +67,7 @@ class Projects::BlobController < Projects::ApplicationController
end
def
diff
@blob
.
load_all_data!
(
@repository
)
@form
=
UnfoldForm
.
new
(
params
)
@lines
=
@blob
.
data
.
lines
[
@form
.
since
-
1
..
@form
.
to
-
1
]
...
...
app/models/ci/commit.rb
View file @
64c8ee47
...
...
@@ -205,7 +205,11 @@ module Ci
end
def
ci_yaml_file
@ci_yaml_file
||=
project
.
repository
.
blob_at
(
sha
,
'.gitlab-ci.yml'
).
data
return
@ci_yaml_file
if
defined?
(
@ci_yaml_file
)
blob
=
project
.
repository
.
blob_at
(
sha
,
'.gitlab-ci.yml'
)
blob
.
load_all_data!
(
project
.
repository
)
@ci_yaml_file
=
blob
.
data
rescue
nil
end
...
...
app/models/tree.rb
View file @
64c8ee47
...
...
@@ -31,6 +31,8 @@ class Tree
git_repo
=
repository
.
raw_repository
@readme
=
Gitlab
::
Git
::
Blob
.
find
(
git_repo
,
sha
,
readme_path
)
@readme
.
load_all_data!
(
git_repo
)
@readme
end
def
trees
...
...
app/views/projects/blob/_blob.html.haml
View file @
64c8ee47
...
...
@@ -35,6 +35,7 @@
-
if
blob
.
lfs_pointer?
=
render
"download"
,
blob:
blob
-
elsif
blob
.
text?
-
blob
.
load_all_data!
(
@repository
)
=
render
"text"
,
blob:
blob
-
elsif
blob
.
image?
=
render
"image"
,
blob:
blob
...
...
lib/api/files.rb
View file @
64c8ee47
...
...
@@ -58,9 +58,11 @@ module API
commit
=
user_project
.
commit
(
ref
)
not_found!
'Commit'
unless
commit
blob
=
user_project
.
repository
.
blob_at
(
commit
.
sha
,
file_path
)
repo
=
user_project
.
repository
blob
=
repo
.
blob_at
(
commit
.
sha
,
file_path
)
if
blob
blob
.
load_all_data!
(
repo
)
status
(
200
)
{
...
...
@@ -72,7 +74,7 @@ module API
ref:
ref
,
blob_id:
blob
.
id
,
commit_id:
commit
.
id
,
last_commit_id:
user_project
.
repository
.
last_commit_for_path
(
commit
.
sha
,
file_path
).
id
last_commit_id:
repo
.
last_commit_for_path
(
commit
.
sha
,
file_path
).
id
}
else
not_found!
'File'
...
...
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