@@ -9,14 +9,15 @@ import { createLogger } from '@sourcebot/shared';
99import path from 'path' ;
1010import { simpleGit } from 'simple-git' ;
1111import { FileTreeItem } from './types' ;
12- import { buildFileTree , isPathValid , normalizePath } from './utils' ;
12+ import { buildFileTree , normalizePath } from './utils' ;
1313import { compareFileTreeItems } from './utils' ;
1414
1515const logger = createLogger ( 'file-tree' ) ;
1616
1717/**
18- * Returns the tree of files (blobs) and directories (trees) for a given repository,
19- * at a given revision.
18+ * Returns a file tree spanning the union of all provided paths for the given
19+ * repo/revision, including intermediate directories needed to connect them
20+ * into a single tree.
2021 */
2122export const getTree = async ( params : { repoName : string , revisionName : string , paths : string [ ] } ) => sew ( ( ) =>
2223 withOptionalAuthV2 ( async ( { org, prisma } ) => {
@@ -35,10 +36,6 @@ export const getTree = async (params: { repoName: string, revisionName: string,
3536 const { path : repoPath } = getRepoPath ( repo ) ;
3637
3738 const git = simpleGit ( ) . cwd ( repoPath ) ;
38- if ( ! paths . every ( path => isPathValid ( path ) ) ) {
39- return notFound ( ) ;
40- }
41-
4239 const normalizedPaths = paths . map ( path => normalizePath ( path ) ) ;
4340
4441 let result : string = '' ;
@@ -103,9 +100,6 @@ export const getFolderContents = async (params: { repoName: string, revisionName
103100 const { path : repoPath } = getRepoPath ( repo ) ;
104101 const git = simpleGit ( ) . cwd ( repoPath ) ;
105102
106- if ( ! isPathValid ( path ) ) {
107- return notFound ( ) ;
108- }
109103 const normalizedPath = normalizePath ( path ) ;
110104
111105 let result : string ;
0 commit comments