Skip to content

Commit

Permalink
fix: sum folder paths in n depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Oct 13, 2022
1 parent dbf36b2 commit e690164
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/gitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,18 @@ export abstract class GitManager {
*/
private simplify(tree: TreeItem[]): TreeItem[] {
for (const node of tree) {
const singleChild = node.children?.length == 1;
const singleChildIsDir = node.children?.first()?.statusResult == undefined;
if (node.children != undefined && singleChild && singleChildIsDir) {
while (true) {
const singleChild = node.children?.length == 1;
const singleChildIsDir = node.children?.first()?.statusResult == undefined;

if (!(node.children != undefined && singleChild && singleChildIsDir)) break;

node.title += "/" + node.children.first()!.title;
node.statusResult = node.children.first()!.statusResult;
node.path = node.children.first()!.path;
node.children = node.children.first()!.children;
} else if (node.children != undefined) {
}
if (node.children != undefined) {
this.simplify(node.children);
}
node.children?.sort((a, b) => {
Expand Down

0 comments on commit e690164

Please sign in to comment.