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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
9a2e3d3d
Commit
9a2e3d3d
authored
9 years ago
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken file browsing with relative submodule in personal projects
Closes
https://github.com/gitlabhq/gitlabhq/issues/7554
parent
e3682122
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
CHANGELOG
CHANGELOG
+1
-1
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+1
-1
spec/helpers/submodule_helper_spec.rb
spec/helpers/submodule_helper_spec.rb
+11
-4
No files found.
CHANGELOG
View file @
9a2e3d3d
...
@@ -4,7 +4,7 @@ v 7.11.0 (unreleased)
...
@@ -4,7 +4,7 @@ v 7.11.0 (unreleased)
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Ignore invalid lines in .gitmodules
- Ignore invalid lines in .gitmodules
- Fix "Cannot move project" error message from popping up after a successful transfer (Stan Hu)
- Fix "Cannot move project" error message from popping up after a successful transfer (Stan Hu)
-
-
Fix broken file browsing with relative submodule in personal projects (Stan Hu)
- Add "Reply quoting selected text" shortcut key (`r`)
- Add "Reply quoting selected text" shortcut key (`r`)
-
-
-
-
...
...
This diff is collapsed.
Click to expand it.
app/helpers/submodule_helper.rb
View file @
9a2e3d3d
...
@@ -63,7 +63,7 @@ module SubmoduleHelper
...
@@ -63,7 +63,7 @@ module SubmoduleHelper
namespace
=
components
.
pop
.
gsub
(
/^\.\.$/
,
''
)
namespace
=
components
.
pop
.
gsub
(
/^\.\.$/
,
''
)
if
namespace
.
empty?
if
namespace
.
empty?
namespace
=
@project
.
group
.
path
namespace
=
@project
.
namespace
.
name
end
end
[
[
...
...
This diff is collapsed.
Click to expand it.
spec/helpers/submodule_helper_spec.rb
View file @
9a2e3d3d
...
@@ -117,34 +117,41 @@ describe SubmoduleHelper do
...
@@ -117,34 +117,41 @@ describe SubmoduleHelper do
context
'submodules with relative links'
do
context
'submodules with relative links'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:commit_id
)
{
sample_commit
[
:id
]
}
before
do
before
do
self
.
instance_variable_set
(
:@project
,
project
)
self
.
instance_variable_set
(
:@project
,
project
)
end
end
it
'one level down'
do
it
'one level down'
do
commit_id
=
sample_commit
[
:id
]
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
end
end
it
'two levels down'
do
it
'two levels down'
do
commit_id
=
sample_commit
[
:id
]
result
=
relative_self_links
(
'../../test.git'
,
commit_id
)
result
=
relative_self_links
(
'../../test.git'
,
commit_id
)
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
expect
(
result
).
to
eq
([
"/
#{
group
.
path
}
/test"
,
"/
#{
group
.
path
}
/test/tree/
#{
commit_id
}
"
])
end
end
it
'one level down with namespace and repo'
do
it
'one level down with namespace and repo'
do
commit_id
=
sample_commit
[
:id
]
result
=
relative_self_links
(
'../foobar/test.git'
,
commit_id
)
result
=
relative_self_links
(
'../foobar/test.git'
,
commit_id
)
expect
(
result
).
to
eq
([
"/foobar/test"
,
"/foobar/test/tree/
#{
commit_id
}
"
])
expect
(
result
).
to
eq
([
"/foobar/test"
,
"/foobar/test/tree/
#{
commit_id
}
"
])
end
end
it
'two levels down with namespace and repo'
do
it
'two levels down with namespace and repo'
do
commit_id
=
sample_commit
[
:id
]
result
=
relative_self_links
(
'../foobar/baz/test.git'
,
commit_id
)
result
=
relative_self_links
(
'../foobar/baz/test.git'
,
commit_id
)
expect
(
result
).
to
eq
([
"/baz/test"
,
"/baz/test/tree/
#{
commit_id
}
"
])
expect
(
result
).
to
eq
([
"/baz/test"
,
"/baz/test/tree/
#{
commit_id
}
"
])
end
end
context
'personal project'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
it
'one level down with personal project'
do
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
expect
(
result
).
to
eq
([
"/
#{
user
.
username
}
/test"
,
"/
#{
user
.
username
}
/test/tree/
#{
commit_id
}
"
])
end
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
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