Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwin612 committed Dec 10, 2024
1 parent d9a23e9 commit 50b8c44
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions services/gitdiff/gitdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,8 @@ func buildTree(files []*DiffFile) []*FileTreeNode {
if len(node.Children) > 0 {
mergedNode := mergeSingleChildDirs(node)
roots = append(roots, mergedNode)
} else {
roots = append(roots, node)
}
}
return roots
Expand All @@ -1446,13 +1448,10 @@ func mergeSingleChildDirs(node *FileTreeNode) *FileTreeNode {
IsFile: node.Children[0].IsFile,
File: node.Children[0].File,
}
if merged.File != nil {
merged.IsFile = true
}
return merged
return mergeSingleChildDirs(merged)
}
for _, child := range node.Children {
mergeSingleChildDirs(child)
for i, child := range node.Children {
node.Children[i] = mergeSingleChildDirs(child)
}
return node
}

0 comments on commit 50b8c44

Please sign in to comment.