pretty-quick icon indicating copy to clipboard operation
pretty-quick copied to clipboard

pretty-quick does not find any changed file

Open jocelynlecomte opened this issue 3 years ago • 15 comments

I'm working with node 12.18.1, [email protected], and [email protected] on a windows 10 computer. I have this strange behaviour:

$ git status
On branch feature/code-quality
Your branch is up to date with 'origin/feature/code-quality'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
        modified:   src/app/app.component.spec.ts

then

$ npx pretty-quick --staged
�  Finding changed files since git revision 2ba99b6.
�  Found 0 changed files.
✅  Everything is awesome!

but

$ npx prettier --check **
Checking formatting...
src\app\app.component.spec.ts
Code style issues found in the above file(s). Forgot to run Prettier?

Any idea ?

jocelynlecomte avatar Apr 01 '21 08:04 jocelynlecomte

I have a similar problem but it just returns "Git Revision null"

image

TomCockram avatar Apr 08 '21 14:04 TomCockram

@TomCockram same same. What's the environment where you get that null? Also in a git action?

$ npx pretty-quick --check --branch develop && ng lint
🔍  Finding changed files since git revision null.
Command failed with exit code 2 (ENOENT): git diff --name-only --diff-filter=ACMRTUB
spawnSync git ENOENT
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

landon-buttars-wgu avatar May 11 '21 23:05 landon-buttars-wgu

Maybe related to https://github.com/azz/pretty-quick/issues/129?

landon-buttars-wgu avatar May 11 '21 23:05 landon-buttars-wgu

@TomCockram same same. What's the environment where you get that null? Also in a git action?

$ npx pretty-quick --check --branch develop && ng lint
🔍  Finding changed files since git revision null.
Command failed with exit code 2 (ENOENT): git diff --name-only --diff-filter=ACMRTUB
spawnSync git ENOENT
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I get this behaviour when performing this in a GitHub action.

TomCockram avatar May 13 '21 13:05 TomCockram

Same here

OliverBhm avatar Nov 09 '21 13:11 OliverBhm

image Same here, I have files staged. But there not detected. Could it have something to do with the fact that I'm in a monorepo not in the Root directory?

ray1618 avatar Dec 20 '21 14:12 ray1618

image

Same here, I have files staged. But there not detected. Could it have something to do with the fact that I'm in a monorepo not in the Root directory?

I'm working in a root directory and got this issue so don't think it's that.

TomCockram avatar Dec 22 '21 12:12 TomCockram

The issue is, that pretty-quick uses git under the hood. If you use alpine or ubuntu slim images, they usually don't have git command out of the box. Make sure, that you install git in your CI runner.

zoltan-nz avatar Mar 05 '22 03:03 zoltan-nz

i was also getting the git revision null message when i ran npx pretty-quick --staged

Needed to add the --branch main flag since it compares against master by default (as it says in the docs - which i did not read).

adanilev avatar Mar 30 '22 08:03 adanilev

Happens the same to me on Azure DevOps (while working fine locally)

alexferrari88 avatar Jul 07 '22 09:07 alexferrari88

i was also getting the git revision null message when i ran npx pretty-quick --staged

Needed to add the --branch main flag since it compares against master by default (as it says in the docs - which i did not read).

I had an issue where pretty-quick was including files in our monorepo in parent folders relative to where I was running it, but I hadn't changed. Turns out using this flag against the target branch fixed my issue. Thanks!

andymerskin avatar Apr 12 '23 19:04 andymerskin

How to use this in GitHub Actions with actions/checkout@v3? I have tried to set fetch-depth=0 but still no changes found. Locally the same command works nicely so I guess the problem is in Github's way to do checkout.

heikkis avatar Aug 18 '23 11:08 heikkis

same problem here with "Found 0 changed files". i'm using this but it doesn't find changed files: run: npx -p [email protected] -p [email protected] pretty-quick --staged --branch main

chrisconfirm avatar Aug 29 '23 10:08 chrisconfirm

seems there is a bug, see here https://github.com/orgs/community/discussions/39880

chrisconfirm avatar Aug 31 '23 06:08 chrisconfirm

A minimal but runnable online reproduction is required.

JounQin avatar Jan 16 '24 11:01 JounQin