Lage throws error when ran outside git repo
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 816
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Lage refuses to run if it's not in a git repo:
...> pnpm build
> monorepo@ build /home/paulius/code/other/lage-starter
> lage build
lage - Version 2.7.5 - 23 Workers
[11:15:15] - error Error: Command failed with exit code 128: git ls-files -z
fatal: not a git repository (or any of the parent directories): .git
ELIFECYCLE Command failed with exit code 1.
Most users probably use lage in a git repo, but I wanted to try it out before creating one. Even when I initialized a git repo, it still wasn't satisfied as it couldn't find HEAD, so I also had to create a commit. I think that's a bit excessive, especially because lage doesn't seem to have any meaningful integration with git.
To Reproduce
Steps to reproduce the behavior:
- Create an empty pnpm workspace in a local folder (not a git repo)
- Add a package with a "build" script and a lage "build" pipeline
- Try running
lage build - See error above
Expected behavior
The build script should be called
Environment/Troubleshooting
System:
OS: Linux 5.15 openSUSE Tumbleweed 20230716
CPU: (24) x64 Intel(R) Core(TM) i9-9920X CPU @ 3.50GHz
Memory: 2.58 GB / 15.52 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
Binaries:
Node: 18.16.1 - ~/.nvs/default/bin/node
Yarn: 1.22.19 - ~/.local/share/pnpm/yarn
npm: 9.5.1 - ~/.nvs/default/bin/npm
pnpm: 8.6.7 - ~/.nvs/default/bin/pnpm
Managers:
pip3: 23.1.2 - /usr/bin/pip3
RubyGems: 3.4.10 - /usr/bin/gem
Utilities:
Make: 4.4.1 - /usr/bin/make
GCC: 13.1.1 - /usr/bin/gcc
Git: 2.41.0 - /usr/bin/git
Clang: 16.0.6 - /usr/bin/clang
Mercurial: 6.4.4 - /usr/bin/hg
Curl: 8.1.2 - /usr/bin/curl
Virtualization:
Docker: 24.0.4 - /usr/bin/docker
IDEs:
Nano: 7.2 - /usr/bin/nano
VSCode: 1.80.1 - /home/paulius/.vscode-server/bin/74f6148eb9ea00507ec113ec51c489d6ffb4b771/bin/remote-cli/code
Vim: 9.0 - /usr/bin/vim
Languages:
Bash: 5.2.15 - /usr/bin/bash
Go: 1.20.5 - /usr/local/go/bin/go
Perl: 5.36.1 - /usr/bin/perl
Python3: 3.11.4 - /usr/bin/python3
Ruby: 3.2.2 - /usr/bin/ruby
Databases:
PostgreSQL: 15.3 - /usr/bin/postgres
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by searching the Lage source for the git ls-files -z invocation used by lage build; no file is named in the issue. Reproduce the empty pnpm workspace outside Git, then verify that lage build runs the package build script without requiring a repository or HEAD.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, node.js, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100