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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f46a77a6
Commit
f46a77a6
authored
Nov 18, 2019
by
George Koltsov
Committed by
Heinrich Lee Yu
Nov 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sub group export to export direct children
parent
d357c692
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
changelogs/unreleased/georgekoltsov-fix-group-export-descendants.yml
...unreleased/georgekoltsov-fix-group-export-descendants.yml
+5
-0
lib/gitlab/import_export/group_tree_saver.rb
lib/gitlab/import_export/group_tree_saver.rb
+3
-3
spec/lib/gitlab/import_export/group_tree_saver_spec.rb
spec/lib/gitlab/import_export/group_tree_saver_spec.rb
+19
-1
No files found.
changelogs/unreleased/georgekoltsov-fix-group-export-descendants.yml
0 → 100644
View file @
f46a77a6
---
title
:
Fix sub group export to export direct children
merge_request
:
20172
author
:
type
:
fixed
lib/gitlab/import_export/group_tree_saver.rb
View file @
f46a77a6
...
...
@@ -28,9 +28,9 @@ module Gitlab
def
serialize
(
group
,
relations_tree
)
group_tree
=
tree_saver
.
serialize
(
group
,
relations_tree
)
group
.
descendants
.
each
do
|
descendant
|
group_tree
[
'
descendants'
]
=
[]
unless
group_tree
[
'descendants'
]
group_tree
[
'
descendants'
]
<<
serialize
(
descendant
,
relations_tree
)
group
.
children
.
each
do
|
child
|
group_tree
[
'
children'
]
||=
[
]
group_tree
[
'
children'
]
<<
serialize
(
child
,
relations_tree
)
end
group_tree
...
...
spec/lib/gitlab/import_export/group_tree_saver_spec.rb
View file @
f46a77a6
...
...
@@ -39,12 +39,16 @@ describe Gitlab::ImportExport::GroupTreeSaver do
end
context
'when :export_fast_serialize feature is enabled'
do
let
(
:serializer
)
{
instance_double
(
Gitlab
::
ImportExport
::
FastHashSerializer
)
}
before
do
stub_feature_flags
(
export_fast_serialize:
true
)
expect
(
Gitlab
::
ImportExport
::
FastHashSerializer
).
to
receive
(
:new
).
with
(
group
,
group_tree
).
and_return
(
serializer
)
end
it
'uses FastHashSerializer'
do
expect
_any_instance_of
(
Gitlab
::
ImportExport
::
FastHashSerializer
).
to
receive
(
:execute
).
and_call_original
expect
(
serializer
).
to
receive
(
:execute
)
group_tree_saver
.
save
end
...
...
@@ -103,6 +107,18 @@ describe Gitlab::ImportExport::GroupTreeSaver do
expect
(
saved_group_json
[
'badges'
]).
not_to
be_empty
end
context
'group children'
do
let
(
:children
)
{
group
.
children
}
it
'exports group children'
do
expect
(
saved_group_json
[
'children'
].
length
).
to
eq
(
children
.
count
)
end
it
'exports group children of children'
do
expect
(
saved_group_json
[
'children'
].
first
[
'children'
].
length
).
to
eq
(
children
.
first
.
children
.
count
)
end
end
context
'group members'
do
let
(
:user2
)
{
create
(
:user
,
email:
'group@member.com'
)
}
let
(
:member_emails
)
do
...
...
@@ -146,6 +162,8 @@ describe Gitlab::ImportExport::GroupTreeSaver do
def
setup_group
group
=
create
(
:group
,
description:
'description'
)
sub_group
=
create
(
:group
,
description:
'description'
,
parent:
group
)
create
(
:group
,
description:
'description'
,
parent:
sub_group
)
create
(
:milestone
,
group:
group
)
create
(
:group_badge
,
group:
group
)
group_label
=
create
(
:group_label
,
group:
group
)
...
...
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