Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix untracked file handling #780

Merged
merged 8 commits into from Jan 27, 2020
Merged

Fix untracked file handling #780

merged 8 commits into from Jan 27, 2020

Conversation

iiroj
Copy link
Member

@iiroj iiroj commented Jan 27, 2020

This PR adds missing error handling to the untracked files restoration, and uses the same diff arguments as for the unstaged diff.

These omissions when combined possibly lead to new untracked files getting lost when running lint-staged. The test didn't detect this because one reason might be the missing --binary flag.

The test coverage dropped significantly because now when the backup stash is missing, runAll fails earlier. Not sure how to test the last error handler at this point.

Fixes #779

@iiroj iiroj mentioned this pull request Jan 27, 2020
@codecov
Copy link

codecov bot commented Jan 27, 2020

Codecov Report

Merging #780 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #780   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          13     13           
  Lines         449    480   +31     
  Branches      104    107    +3     
=====================================
+ Hits          449    480   +31
Impacted Files Coverage Δ
lib/runAll.js 100% <100%> (ø) ⬆️
lib/gitWorkflow.js 100% <100%> (ø) ⬆️
lib/file.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f2a1c0...b9d5939. Read the comment docs.

lib/file.js Show resolved Hide resolved
@iiroj
Copy link
Member Author

iiroj commented Jan 27, 2020

@okonet if you're fine with these changes, please leave an approving review so that the merge button gets enabled for me.

@iiroj iiroj merged commit 4010db0 into master Jan 27, 2020
@iiroj iiroj deleted the fix-untracked branch January 27, 2020 13:10
@okonet
Copy link
Collaborator

okonet commented Jan 27, 2020

🎉 This PR is included in version 10.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@millette
Copy link

@okonet Thanks for the quick turnaround.

Could you also run the following, which I think will make life easier, just in case:

npm deprecate lint-staged@10.0.2 "Broken, do not use"

@okonet
Copy link
Collaborator

okonet commented Jan 28, 2020

@millette you should thank @iiroj since he was working on that.

npm deprecate lint-staged@10.0.2 "Broken, do not use"

Pretty much every previous version should be deprecated then, no? I don't see any reason to deprecate previous version since the fix is the patch release and should be automatically resolved by any modern bundlers.

@millette
Copy link

millette commented Jan 29, 2020

Thank you @iiroj

@okonet Well, the problem that deletes uncommited files is rather serious. I don't know to which versions it applies, hopefully only 10.0.2 but it's the sort of example given on https://docs.npmjs.com/cli/deprecate.

Semver takes care of this, sure. But a warning would be appreciated, and that's what npm deprecate provides.

@iiroj
Copy link
Member Author

iiroj commented Jan 29, 2020

@millette we would probably have to deprecate versions 10.0.0, 10.0.1, and 10.0.2 because this bug was introduced in the breaking changes.

Luckily the files are not, and are recoverable from the depths of git (see the related issue).

@okonet
Copy link
Collaborator

okonet commented Jan 29, 2020

V9 also had “serious” bugs that’s why v10 was released. I don’t think it’s worth the maintenance time to go through and deprecate all of those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Lost new untracked files
3 participants