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
7d2affef
Commit
7d2affef
authored
Dec 14, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved lfs blob fetch from extractspath file
parent
3032989a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
6 deletions
+11
-6
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+3
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+6
-0
app/views/projects/blob/_header_content.html.haml
app/views/projects/blob/_header_content.html.haml
+1
-1
app/views/projects/tree/_blob_item.html.haml
app/views/projects/tree/_blob_item.html.haml
+1
-1
lib/extracts_path.rb
lib/extracts_path.rb
+0
-4
No files found.
app/controllers/projects/tree_controller.rb
View file @
7d2affef
...
@@ -26,7 +26,10 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -26,7 +26,10 @@ class Projects::TreeController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
blob_ids
=
tree
.
blobs
.
map
(
&
:id
)
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@tree
.
path
)
||
@commit
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@tree
.
path
)
||
@commit
@lfs_blob_ids
=
Gitlab
::
Git
::
Blob
.
batch_lfs_pointers
(
@repo
,
blob_ids
).
map
(
&
:id
)
end
end
format
.
js
do
format
.
js
do
...
...
app/controllers/projects_controller.rb
View file @
7d2affef
...
@@ -9,6 +9,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -9,6 +9,7 @@ class ProjectsController < Projects::ApplicationController
before_action
:repository
,
except:
[
:index
,
:new
,
:create
]
before_action
:repository
,
except:
[
:index
,
:new
,
:create
]
before_action
:assign_ref_vars
,
only:
[
:show
],
if: :repo_exists?
before_action
:assign_ref_vars
,
only:
[
:show
],
if: :repo_exists?
before_action
:tree
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:tree
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:lfs_blob_ids
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:project_export_enabled
,
only:
[
:export
,
:download_export
,
:remove_export
,
:generate_new_export
]
before_action
:project_export_enabled
,
only:
[
:export
,
:download_export
,
:remove_export
,
:generate_new_export
]
# Authorize
# Authorize
...
@@ -403,4 +404,9 @@ class ProjectsController < Projects::ApplicationController
...
@@ -403,4 +404,9 @@ class ProjectsController < Projects::ApplicationController
#
#
redirect_to
request
.
original_url
.
sub
(
/\.git\/?\Z/
,
''
)
if
params
[
:format
]
==
'git'
redirect_to
request
.
original_url
.
sub
(
/\.git\/?\Z/
,
''
)
if
params
[
:format
]
==
'git'
end
end
def
lfs_blob_ids
blob_ids
=
tree
.
blobs
.
map
(
&
:id
)
@lfs_blob_ids
=
Gitlab
::
Git
::
Blob
.
batch_lfs_pointers
(
@repo
,
blob_ids
).
map
(
&
:id
)
end
end
end
app/views/projects/blob/_header_content.html.haml
View file @
7d2affef
...
@@ -9,5 +9,5 @@
...
@@ -9,5 +9,5 @@
%small
%small
=
number_to_human_size
(
blob
.
raw_size
)
=
number_to_human_size
(
blob
.
raw_size
)
-
if
blob
.
stored_externally?
-
if
blob
.
stored_externally?
&&
blob
.
external_storage
==
:lfs
%span
.label.label-lfs.append-right-5
LFS
%span
.label.label-lfs.append-right-5
LFS
app/views/projects/tree/_blob_item.html.haml
View file @
7d2affef
-
is_lfs_blob
=
@lfs_blob
s
.
select
{
|
b
|
b
.
id
===
blob_item
.
id
}.
any?
-
is_lfs_blob
=
@lfs_blob
_ids
.
include?
(
blob_item
.
id
)
%tr
{
class:
"tree-item #{tree_hex_class(blob_item)}"
}
%tr
{
class:
"tree-item #{tree_hex_class(blob_item)}"
}
%td
.tree-item-file-name
%td
.tree-item-file-name
=
tree_icon
(
type
,
blob_item
.
mode
,
blob_item
.
name
)
=
tree_icon
(
type
,
blob_item
.
mode
,
blob_item
.
name
)
...
...
lib/extracts_path.rb
View file @
7d2affef
...
@@ -127,10 +127,6 @@ module ExtractsPath
...
@@ -127,10 +127,6 @@ module ExtractsPath
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
@path
)
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
@path
)
@logs_path
=
logs_file_project_ref_path
(
@project
,
@ref
,
@path
)
@logs_path
=
logs_file_project_ref_path
(
@project
,
@ref
,
@path
)
blob_ids
=
tree
.
blobs
.
map
(
&
:id
)
@lfs_blobs
=
Gitlab
::
Git
::
Blob
.
batch_lfs_pointers
(
@repo
,
blob_ids
)
rescue
RuntimeError
,
NoMethodError
,
InvalidPathError
rescue
RuntimeError
,
NoMethodError
,
InvalidPathError
render_404
render_404
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