Skip to content

Commit

Permalink
RND-102 Fix repo removal on exception (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubama authored Mar 30, 2023
1 parent 2257cd1 commit 15df9f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ export const cloneGitRepo = async <Result>(
};

const removeGitRepo = (repositoryPath: string) => {
fs.rmdirSync(repositoryPath, { recursive: true });
if (fs.existsSync(repositoryPath)) fs.rmdirSync(repositoryPath, { recursive: true });
};
2 changes: 1 addition & 1 deletion packages/backend/test/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ describe('git', () => {
'--filter=blob:none'
]);
expect(callback).toHaveBeenCalledWith(repositoryPath);
expect(fs.rmdirSync).toHaveBeenCalledWith(repositoryPath, { recursive: true });
expect(fs.existsSync).toHaveBeenCalledWith(repositoryPath);
});
});

0 comments on commit 15df9f3

Please sign in to comment.