mateodelnorte / meta

tool for turning many repos into a meta repo. why choose many repos or a monolithic repo, when you can have both with a meta repo?
MIT License
2.03k stars 95 forks source link

Error when Cloning Meta Repository with Nested Directories #337

Open ShethRuchi opened 2 months ago

ShethRuchi commented 2 months ago

🐛 Bug Report

We are experiencing an issue when attempting to clone a meta repository that contains nested directories. The cloning process fails with an ENOENT error, indicating that the specified directory does not exist. This issue occurs when the meta repository includes deeply nested project paths.

To Reproduce

Create a meta repository with a structure including nested directories. projects | |--Proejct1 |----|---repo1 |----|---repo2 |----|---repo3 |--Proejct2 |----|---repo4 |----|---repo5 |----|---repo6

Add a .meta file with nested project paths. For example

{
  "projects": {
    "project1/repo1": "git repo URL",
    "project1/repo2": "git repo URL",
    "project1/repo3": "git repo URL",
    "project2/repo4": "git repo URL",
    "project2/repo5": "git repo URL",
    "project2/repo6": "git repo url",
  }
}

Try to clone the meta repository using the command: meta git clone inside directory ~/Development/work/

Error

warn: The current directory is not a meta repo:
  ~/Development/work/projects
And none of your ancestors are meta repos, either.
node:internal/bootstrap/switches/does_own_process_state:124
  rawMethods.chdir(directory);
             ^
Error: ENOENT: no such file or directory, chdir '/home/sheth/Development/work//projects' -> '/home/sheth/Development/work//projects/projects'
    at process.wrappedChdir [as chdir] (node:internal/bootstrap/switches/does_own_process_state:124:14)
    at /home/sheth/.nvm/versions/node/v20.8.0/lib/node_modules/meta/node_modules/meta-git/bin/meta-git-clone:28:11
    at /home/sheth/.nvm/versions/node/v20.8.0/lib/node_modules/meta/node_modules/meta-exec/index.js:104:22
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'chdir',
  path: '/home/sheth/Development/work/projects',
  dest: '/home/sheth/Development/work/projects/projects'
}

Expected behavior

The meta repository and its nested projects should be cloned without errors. dest path should be /home/sheth/Development/work/projects it should not create projects directory inside projects directory