Skip to content

[BUG] SSH retry can retry on directory created by HTTP try tried first #274

@mvorisek

Description

@mvorisek

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

It took me a lot of time to figure out my git/ssh setup problem.

I was getting fatal: destination path 'C:\Users\mvorisek\AppData\Local\npm-cache\_cacache\tmp\git-cloneQLKQWC/.git' already exists and is not an empty directory error.

The error was cause by:

https://github.com/npm/pacote/blob/v15.1.1/lib/git.js#L289

and

https://github.com/npm/pacote/blob/v15.1.1/lib/git.js#L249

retry mechanism which is broken - when the 1st clone (via https) has created the tmp directory, the 2nd clone (via ssh) will fail with the error message above

Expected Behavior

As the retry mechanism seems to be working in properly configured git/ssh setup, I propose to check if the tmp/destination directory is still empty after the 1st try, if not, never retry, and throw the exception from the 1st try.

Steps To Reproduce

You should be able to reproduce with fake git client which will always exit with non-zero code and create some file in the tmp/target directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds an initial review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions