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

`meta project import` modifies .gitignore even with faulty input params #297

Closed eddex closed 2 years ago

eddex commented 2 years ago

🐛 Bug Report

When I run the meta project import command, I often forget to add both dest and repoURL params. Instead I just add one param (usually the repo URL). Meta then proceeds to modify the .gitignore file, then tries to clone the repo but fails, hence not modifying the .meta file. The .gitignore file now contains the git URL, which is not correct.

To Reproduce

Example:

> meta project import git@github.com:eddex/some-repo.git
{ repoUrl: undefined, dest: 'git@github.com:eddex\\some-repo.git' }

~\work\meta-repo:
fatal: repository 'undefined' does not exist
~\work\meta-repo: command 'git clone  undefined git@github.com:eddex\some-repo.git' exited with error: Error: Command failed: git clone  undefined git@github.com:eddex\some-repo.git
Appending to ~\work\meta-repo\.gitignore
Updating "projects" in ~\work\meta-repo\.meta

✓ Project imported: git@github.com:eddex\some-repo.git

The only modified file after this command is the .gitignore, meta adds the dest param (which in this case is the git URL):

+/git@github.com:eddex\some-repo.git/

Expected behavior

If only one param is detected (one of them is null/undefined), the command should be aborted and no files should be modified.

Alternatively, it would be great to allow only passing the repoURL and automatically parsing the repo name from it.

eddex commented 2 years ago

I just realized that this issue should be opened in the meta-project repo. Opened it here https://github.com/mateodelnorte/meta-project/issues/104 and closing this issue.