aspect-build/aspect-cli

[Bug]: `aspect init` errors when `working tree is dirty`

albertocavalcante opened this issue · 0 comments

What happened?

When running aspect init at a directory that contains a dirty worktree, it fails with the following:

$ aspect init
{"level":"warn","time":"2024-07-03T03:22:20-03:00","message":"working tree is dirty, use --force to apply changes"}
Error: missing scaffold path

Then if I try:

$ aspect init --force
Error: unknown flag: --force

Indeed aspect help init does not contain a --force flag, but I think this suggestion is misleading to the user. (My guess is that this message comes from the downstream dependency).

With regards to the scaffold path error message I didn't dig into it, once I had my worktree clean again, it executed successfully.

Version

Development (host) and target OS/architectures: linux_x86_amd64 (WSL2 Ubuntu)

Output of bazel --version: bazel 7.2.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: N/A

Language(s) and/or frameworks involved: N/A

How to reproduce

mkdir reproducible

cd reproducible

git init

echo 7.2.1 > .bazelversion

cat > .bazeliskrc << EOF
BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download
USE_BAZEL_VERSION=aspect/5.10.1
EOF

git add .bazeliskrc .bazelversion

git commit -m "initial commit"

echo BAZELISK_HOME=/tmp >> .bazeliskrc

git status

aspect init

Any other information?

No response