node-git-server icon indicating copy to clipboard operation
node-git-server copied to clipboard

Extra folder created

Open orosmatthew opened this issue 2 years ago • 1 comments

I have code to loop and create multiple repos in the repo/ directory as shown. It does this all correctly but also creates an empty folder in my main project directory. I can confirm that the repos.create() method is the problem because when I comment it out, the extra folder is not created.

https://user-images.githubusercontent.com/32916949/235507071-5f2de60b-9f26-4a8f-bca2-0eddb506184b.mp4

orosmatthew avatar May 01 '23 18:05 orosmatthew

The problem seems to be here in git.ts

    if (typeof callback !== 'function')
      callback = () => {
        return;
      };

    if (!/\.git$/.test(repo)) repo += '.git';

    const exists = this.exists(repo);

    if (!exists) {
      this.mkdir(repo);
    }

    next(this);

The this.mkdir is creating the folder in the wrong directory

orosmatthew avatar May 01 '23 19:05 orosmatthew