You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clean may not to be working as expected (or I don't know what I'm doing wrong) #156
Before the first run of pre-commit on my repo, I created a .pre-commit-config.yaml file with pre-commit-hooks and the id Trim Trailing Whitespace (for testing purposes). It worked perfectly.
Now I've completely replaced the file with these contents:
$ pre-commit clean
Cleaned /home/gabriel/.pre-commit.
$ pre-commit autoupdate
Updating git://github.com/pre-commit/mirrors-jshint...already up to date.
$ pre-commit run
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/gabriel/.pre-commit/patch1409172873.
[INFO] Installing environment for git://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Trim Trailing Whitespace................................................................................................................................Passed
What am I supposed to do? I've even reinstalled pre-commit without success 🐼
ah yeah I've seen this happen before. What's happening is it recognizes the .pre-commit-config.yaml file as unstaged and temporarily stashes it. To fix this git add .pre-commit-config.yaml or pre-commit run --no-stash
The feature that you're running against is pre-commit will only run against staged contents of files.
Let me know if this works for you and if there's somewhere we can update documentation!
Also: pre-commit clean is mostly to clean out broken state (if it ever occurs) in ~/.pre-commit and shouldn't really be necessary in general :)
gabrielpugliese-luizalabs commented on Aug 28, 2014
Yeah it worked like a charm! :) Ty
Personally, I think putting in docs would be bad unless you put a FAQ section with good keywords so Google can index it very well. Otherwise, I would try to implement a way to not stash that file (do normal stash followed by checking out the yaml file - like git checkout stash@{0} -- .pre-commit-config.yaml)
Activity
asottile commentedon Aug 27, 2014
ah yeah I've seen this happen before. What's happening is it recognizes the .pre-commit-config.yaml file as unstaged and temporarily stashes it. To fix this
git add .pre-commit-config.yamlorpre-commit run --no-stashThe feature that you're running against is pre-commit will only run against staged contents of files.
Let me know if this works for you and if there's somewhere we can update documentation!
Also:
pre-commit cleanis mostly to clean out broken state (if it ever occurs) in ~/.pre-commit and shouldn't really be necessary in general :)gabrielpugliese-luizalabs commentedon Aug 28, 2014
Yeah it worked like a charm! :) Ty
Personally, I think putting in docs would be bad unless you put a FAQ section with good keywords so Google can index it very well. Otherwise, I would try to implement a way to not stash that file (do normal stash followed by checking out the yaml file - like
git checkout stash@{0} -- .pre-commit-config.yaml)asottile commentedon Aug 30, 2014
@gabrielpugliese-luizalabs Created #157 to track this
Document pretty-format-json. Resolves pre-commit#156