jpmorganchase / mosaic

https://mosaic-mosaic-dev-team.vercel.app

Home Page:https://mosaic-mosaic-dev-team.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git Sources - reusing worktrees breaks if source branch used was created after initial repo clone

DavieReid opened this issue · comments

commented

When using a git repo source, the repo is cloned and a worktree created for the branch specified by the source in the mosaic config file.

Now lets say you create a new branch in git and update the mosaic config file so that the source uses this new branch. When you spin up mosaic, it will attempt to reuse the previous clone and create a worktree for the new branch.

But the previous clone has no knowledge of the new branch as we did not do a fetch. This breaks the source as the worktree creation fails.

This may only be an issue that manifests when developing locally and using git repos as sources.

Workaround

The workaround is to remove the .tmp directory so that the clone is removed and the repo cloned again on next start-up.

Ideal Solution

We should do a fetch even when reusing a cloned repo so that we have the latest info about the repo.