diff options
Diffstat (limited to 'app/assets/javascripts/diffs/utils/tree_worker_utils.js')
-rw-r--r-- | app/assets/javascripts/diffs/utils/tree_worker_utils.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/assets/javascripts/diffs/utils/tree_worker_utils.js b/app/assets/javascripts/diffs/utils/tree_worker_utils.js index 985e75d1a17..a90c1a5c64e 100644 --- a/app/assets/javascripts/diffs/utils/tree_worker_utils.js +++ b/app/assets/javascripts/diffs/utils/tree_worker_utils.js @@ -62,10 +62,15 @@ export const generateTreeList = (files) => { const split = file.new_path.split('/'); split.forEach((name, i) => { - const parent = acc.treeEntries[split.slice(0, i).join('/')]; + let parent = acc.treeEntries[split.slice(0, i).join('/')]; const path = `${parent ? `${parent.path}/` : ''}${name}`; + const child = acc.treeEntries[path]; - if (!acc.treeEntries[path]) { + if (parent && !parent.tree) { + parent = null; + } + + if (!child || !child.tree) { const type = path === file.new_path ? 'blob' : 'tree'; acc.treeEntries[path] = { key: path, |