Skip to content

Commit 559956e

Browse files
authored
Create the full upload basepath
If a nested basepath `'a/b/c'` is given and does not exist yet, all directories in the basepath will be created, similar to using `mkdir -p`
1 parent fd07ac8 commit 559956e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/gitpuller.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ export abstract class GitPuller {
2323
* @returns the path of the created directory.
2424
*/
2525
async clone(url: string, branch: string, basePath: string): Promise<string> {
26-
await this.createTree([basePath]);
26+
const basePathComponents = basePath.split('/');
27+
const basePathPrefixes = [];
28+
for (let i = 0; i < basePathComponents.length; i++) {
29+
basePathPrefixes.push(basePathComponents.slice(0, i+1).join('/'));
30+
}
31+
32+
// For a basePath 'a/b/c', create ['a', 'a/b', 'a/b/c']
33+
await this.createTree(basePathPrefixes);
2734

2835
const fileList = await this.getFileList(url, branch);
2936

0 commit comments

Comments
 (0)