Do not delete cwd (#86)

这个提交包含在:
eric sciple
2019-12-03 13:43:37 -05:00
提交者 GitHub
父节点 cc70598ce8
当前提交 689bf84be4
共有 2 个文件被更改,包括 12 次插入 和 4 次删除

8
dist/index.js vendored
查看文件

@ -4978,8 +4978,12 @@ function getSource(settings) {
// Try prepare existing directory, otherwise recreate
if (isExisting &&
!(yield tryPrepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean))) {
yield io.rmRF(settings.repositoryPath);
yield io.mkdirP(settings.repositoryPath);
// Delete the contents of the directory. Don't delete the directory itself
// since it may be the current working directory.
core.info(`Deleting the contents of '${settings.repositoryPath}'`);
for (const file of yield fs.promises.readdir(settings.repositoryPath)) {
yield io.rmRF(path.join(settings.repositoryPath, file));
}
}
// Initialize the repository
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {

查看文件

@ -59,8 +59,12 @@ export async function getSource(settings: ISourceSettings): Promise<void> {
settings.clean
))
) {
await io.rmRF(settings.repositoryPath)
await io.mkdirP(settings.repositoryPath)
// Delete the contents of the directory. Don't delete the directory itself
// since it may be the current working directory.
core.info(`Deleting the contents of '${settings.repositoryPath}'`)
for (const file of await fs.promises.readdir(settings.repositoryPath)) {
await io.rmRF(path.join(settings.repositoryPath, file))
}
}
// Initialize the repository