-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
What version of Turborepo are you using?
1.2.9
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Linux
Describe the Bug
I build some services with turborepo inside docker. My docker images are alpine based and don't have git installed. Each docker build gets a pruned copy of the monorepo with just the dependencies it needs - so doesn't have the .git
folder. As a result I wouldn't expect git
to be required.
On turbo 1.2.4 this worked fine. When I upgraded to 1.2.9 yesterday I started getting the following error:
ERROR failed to calculate global hash: error hashing files. make sure that git has been initialized failed to hash files /src/package.json, /src/pnpm-lock.yaml: git hash-object exited with status: exec: "git": executable file not found in $PATH.
I have done a bit of digging and it appears this behaviour was introduced by 3b8d81f which added this bit of error handling where previously errors were ignored.
Digging in a bit more, it seems like parseGitStatus is using quite a permissive regular expression. So when git status
outputs "git": executable file not found in $PATH
, turborepo assumes a file called "git"
has changed and tries to run that through git hash-object
, which fails because git isn't installed.
Expected Behavior
Turborepo should work when git isn't installed and you're not in a git repository.
To Reproduce
I've put together a reproduction repository using one of the turborepo examples, so this should reproduce:
git clone https://github.com/obmarg/turborepo-git-reproduction.git
cd turborepo-git-reproduction
docker build .