We're seeing some reports on Discord about users trying out --only-changed in CI, and being surprised about the "unknown revision" error thrown by Git. This occurs on shallow clones, which is the default for GH Actions. We should detect this and show a nice error message.
Example report from Discord:
Hi! I have a problem with new feature only-changed. I’m using gitlab and I want to use this option when I create new MR.
But I get a error like this:
npx playwright test --grep-invert '@fetch|@no-ci' --project=chromium --only-changed=main --reporter=line
Error: Cannot detect changed files for --only-changed mode:
git diff origin/main --name-only
fatal: ambiguous argument 'main': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
Any idea what i’m doing wrong?