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
If cwd is not same as gitDir #856
Conversation
When using the I think git commands can now also always run in the cwd, which would fix the issue. |
yes, and its not fixed. If my package.json file is not in root/cwd thn git add is failing after linters |
But can you confirm this only happens when using the A straightforward solution would be to resolve the paths before adding them. I can create a fix tomorrow. |
Codecov Report
@@ Coverage Diff @@
## master #856 +/- ##
===========================================
- Coverage 100.00% 99.50% -0.50%
===========================================
Files 17 17
Lines 596 602 +6
Branches 142 143 +1
===========================================
+ Hits 596 599 +3
- Misses 0 3 +3
Continue to review full report at Codecov.
|
The correct fix is to resolve to cwd instead of gitDir here: https://github.com/okonet/lint-staged/blob/master/lib/gitWorkflow.js#L253 The working dir can be set to this.cwd in the constructor options. |
To reproduce issue
cwd will be directory of package.json git add try to add file from path relative to package.json folder. it should be from git root
|
I'll close this PR and opened #857. I'll also add a test case according to your instructions. |
No description provided.