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
Jérome Perrin
gitlab-ce
Commits
0f1d6402
Commit
0f1d6402
authored
Nov 03, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Find the LFS-objects for a fork within a the fork network
parent
7582bc8b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
+57
-4
app/controllers/concerns/lfs_request.rb
app/controllers/concerns/lfs_request.rb
+3
-4
spec/controllers/concerns/lfs_request_spec.rb
spec/controllers/concerns/lfs_request_spec.rb
+50
-0
spec/support/stub_configuration.rb
spec/support/stub_configuration.rb
+4
-0
No files found.
app/controllers/concerns/lfs_request.rb
View file @
0f1d6402
...
@@ -94,10 +94,9 @@ module LfsRequest
...
@@ -94,10 +94,9 @@ module LfsRequest
@storage_project
||=
begin
@storage_project
||=
begin
result
=
project
result
=
project
loop
do
# TODO: Make this go to the fork_network root immeadiatly
break
unless
result
.
forked?
# dependant on the discussion in: https://gitlab.com/gitlab-org/gitlab-ce/issues/39769
result
=
result
.
forked_from_project
result
=
result
.
fork_source
while
result
.
forked?
end
result
result
end
end
...
...
spec/controllers/concerns/lfs_request_spec.rb
0 → 100644
View file @
0f1d6402
require
'spec_helper'
describe
LfsRequest
do
include
ProjectForksHelper
controller
(
Projects
::
GitHttpClientController
)
do
# `described_class` is not available in this context
include
LfsRequest
# rubocop:disable RSpec/DescribedClass
def
show
storage_project
render
nothing:
true
end
def
project
@project
||=
Project
.
find
(
params
[
:id
])
end
def
download_request?
true
end
def
ci?
false
end
end
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
stub_lfs_setting
(
enabled:
true
)
end
describe
'#storage_project'
do
it
'assigns the project as storage project'
do
get
:show
,
id:
project
.
id
expect
(
assigns
(
:storage_project
)).
to
eq
(
project
)
end
it
'assigns the source of a forked project'
do
forked_project
=
fork_project
(
project
)
get
:show
,
id:
forked_project
.
id
expect
(
assigns
(
:storage_project
)).
to
eq
(
project
)
end
end
end
spec/support/stub_configuration.rb
View file @
0f1d6402
...
@@ -38,6 +38,10 @@ module StubConfiguration
...
@@ -38,6 +38,10 @@ module StubConfiguration
allow
(
Gitlab
.
config
.
backup
).
to
receive_messages
(
to_settings
(
messages
))
allow
(
Gitlab
.
config
.
backup
).
to
receive_messages
(
to_settings
(
messages
))
end
end
def
stub_lfs_setting
(
messages
)
allow
(
Gitlab
.
config
.
lfs
).
to
receive_messages
(
to_settings
(
messages
))
end
def
stub_storage_settings
(
messages
)
def
stub_storage_settings
(
messages
)
# Default storage is always required
# Default storage is always required
messages
[
'default'
]
||=
Gitlab
.
config
.
repositories
.
storages
.
default
messages
[
'default'
]
||=
Gitlab
.
config
.
repositories
.
storages
.
default
...
...
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