Replies: 1 comment 1 reply
-
|
Same class of failure here on Lefthook 2.1.9 while testing a Husky/lint-staged migration. Repro shape: partially staged tracked file + mutating pre-commit formatter. Lefthook hid the unstaged patch, the formatter rewrote the same lines, then I could not find a simple “don’t hide unstaged changes” or “fail before mutating if partial staging is present” option. We wanted Lefthook to simplify hooks, but this pushed us toward avoiding Lefthook for A no-hide or fail-fast mode would make this much safer. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm had issues with lefthook duplicating changes when running it on a repository that didn't have any commits. However now that I have commits I've just had an issue where I staged most of the changes but left some unstaged comments about changes that I still needed to apply and work I was progressing with. However after running lefthook (
lefthook run pre-commit) it returned the following error and almost all the uncommitted changes were gone (untracked files were fine; 2 files with changes but none staged were fine; all files with some staged changes retained only the staged changes)/workspaces/foo/.git/info/lefthook-unstaged.patchwas missing almost all the changes and the 2 stashes namedlefthook auto backuponly contained the staged changes.Does lefthook retain a backup of the changes it reverts? Is there a setting to not have it make destructive changes?
I can't think clearly now, having lost quite a bit of work, but the only thing I might have done is stage minor a change after running lefthook. lefthook runs quickly. I'm not sure if I even attempted it.
I think I've recovered most of changes using undoing, resulted in the changes reappearing.
Beta Was this translation helpful? Give feedback.
All reactions