Unverified Commit 689bf84b authored by eric sciple's avatar eric sciple Committed by GitHub
Browse files

Do not delete cwd (#86)

parent cc70598c
Loading
Loading
Loading
Loading
+6 −2
Changes for dist/index.js: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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'))) {
+6 −2
Changes for src/git-source-provider.ts: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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