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
ba1d6d7c
Commit
ba1d6d7c
authored
Mar 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed IDE file list when files have same name but different paths
Closes #5092
parent
6d49d141
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
4 deletions
+67
-4
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+4
-4
ee/changelogs/unreleased/ide-fix-same-file-names.yml
ee/changelogs/unreleased/ide-fix-same-file-names.yml
+5
-0
spec/javascripts/repo/stores/actions/tree_spec.js
spec/javascripts/repo/stores/actions/tree_spec.js
+58
-0
No files found.
app/assets/javascripts/ide/stores/utils.js
View file @
ba1d6d7c
...
...
@@ -121,8 +121,8 @@ export const getTreeEntry = (store, treeId, path) => {
return
fileList
?
fileList
.
find
(
file
=>
file
.
path
===
path
)
:
null
;
};
export
const
findEntry
=
(
tree
,
type
,
name
)
=>
tree
.
find
(
f
=>
f
.
type
===
type
&&
f
.
name
===
name
,
export
const
findEntry
=
(
tree
,
type
,
name
,
prop
=
'
name
'
)
=>
tree
.
find
(
f
=>
f
.
type
===
type
&&
f
[
prop
]
===
name
,
);
export
const
findIndexOfFile
=
(
state
,
file
)
=>
state
.
findIndex
(
f
=>
f
.
path
===
file
.
path
);
...
...
@@ -163,7 +163,7 @@ export const createOrMergeEntry = ({ projectId,
level
,
state
})
=>
{
if
(
state
.
changedFiles
.
length
)
{
const
foundChangedFile
=
findEntry
(
state
.
changedFiles
,
type
,
entry
.
name
);
const
foundChangedFile
=
findEntry
(
state
.
changedFiles
,
type
,
entry
.
path
,
'
path
'
);
if
(
foundChangedFile
)
{
return
foundChangedFile
;
...
...
@@ -171,7 +171,7 @@ export const createOrMergeEntry = ({ projectId,
}
if
(
state
.
openFiles
.
length
)
{
const
foundOpenFile
=
findEntry
(
state
.
openFiles
,
type
,
entry
.
name
);
const
foundOpenFile
=
findEntry
(
state
.
openFiles
,
type
,
entry
.
path
,
'
path
'
);
if
(
foundOpenFile
)
{
return
foundOpenFile
;
...
...
ee/changelogs/unreleased/ide-fix-same-file-names.yml
0 → 100644
View file @
ba1d6d7c
---
title
:
Fixed IDE file list when multiple files have same name but different paths
merge_request
:
author
:
type
:
fixed
spec/javascripts/repo/stores/actions/tree_spec.js
View file @
ba1d6d7c
...
...
@@ -426,5 +426,63 @@ describe('Multi-file store tree actions', () => {
done
();
}).
catch
(
done
.
fail
);
});
it
(
'
does not add changed file with same name but different path
'
,
(
done
)
=>
{
const
f
=
file
(
'
openedFile
'
);
const
tree
=
{
tree
:
[],
};
const
data
=
{
trees
:
[{
name
:
'
tree
'
}],
submodules
:
[{
name
:
'
submodule
'
}],
blobs
:
[
f
],
};
store
.
state
.
changedFiles
.
push
({
...
f
,
type
:
'
blob
'
,
path
:
`src/
${
f
.
name
}
`
,
changed
:
true
,
});
store
.
dispatch
(
'
updateDirectoryData
'
,
{
data
,
tree
,
clearTree
:
false
,
}).
then
(()
=>
{
expect
(
tree
.
tree
[
2
].
changed
).
toBeFalsy
();
done
();
}).
catch
(
done
.
fail
);
});
it
(
'
does not add opened file with same name but different path
'
,
(
done
)
=>
{
const
f
=
file
(
'
openedFile
'
);
const
tree
=
{
tree
:
[],
};
const
data
=
{
trees
:
[{
name
:
'
tree
'
}],
submodules
:
[{
name
:
'
submodule
'
}],
blobs
:
[
f
],
};
store
.
state
.
openFiles
.
push
({
...
f
,
type
:
'
blob
'
,
path
:
`src/
${
f
.
name
}
`
,
opened
:
true
,
});
store
.
dispatch
(
'
updateDirectoryData
'
,
{
data
,
tree
,
clearTree
:
false
,
}).
then
(()
=>
{
expect
(
tree
.
tree
[
2
].
opened
).
toBeFalsy
();
done
();
}).
catch
(
done
.
fail
);
});
});
});
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