Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Script not working in monorepo: Not a git repository: backend/.git #37

Open
dennisameling opened this issue Aug 20, 2022 · 3 comments
Open
Assignees
Labels
issue: feature request Issue suggesting a new feature

Comments

@dennisameling
Copy link

We originally used the strapi-starter-gatsby-corporate template to set up our website. This sets up two folders in a single Git repo: backend (Strapi) and frontend (Gatsby). Now that I'm trying to upgrade/migrate it to v4, I'm running into the error below, as the script is looking for a .git folder in the backend folder, while we only have a .git folder in the root folder of our project.

Could you please add an option to ignore this check? I can make sure myself that my Git working tree is clean 😉 thanks!

% npx @strapi/codemods migrate:application backend
npx: installed 568 in 40.029s
error: Command failed with exit code 128: git --git-dir=backend/.git --work-tree=backend status --porcelain
fatal: not a git repository: 'backend/.git'
@ertrzyiks
Copy link

I was able to use codemods for my monorepo in a way that does not make me proud, but it was a small project so the manual work was insignificant

# Copy workspace to a new folder
rsync -av --progress workspace/path/ ../pretend-to-not-be-a-monorepo

# Go to the new folder
cd ../pretend-to-not-be-a-monorepo

# Init fake git repo
git init
git add .
git commit -m 'Initial commit'

# Migrate fake repo
npx @strapi/codemods migrate  

Then I used a mix of rsync and git diff to move the changes back to my monorepo.

@derrickmehaffy derrickmehaffy added the issue: feature request Issue suggesting a new feature label Oct 27, 2022
@conorjohn
Copy link

It would be good to have this work in a monorepo automatically.

While the work is in progress I did what @ertrzyiks did, but I didn't move it out of the project, I only initialised the git repo inside the ./backend, then once that satisfied the codemods migration, I ran rm -rf ./backend/.git and I was ok to commit to the main repo again.

@cianx
Copy link

cianx commented Mar 27, 2023

Why is a code transform script messing with my source control?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue: feature request Issue suggesting a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants