-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Partially staged files #30
Comments
Sounds like a bug, cc. @mpareja. |
Can't immediately reproduce this. Tried: $ yarn init -y
$ yarn add -D prettier pretty-quick@1.5.0
$ git init
$ echo 'var formatted = true;' > x.js
$ echo 'var unformatted = true ;' > y.js
$ git add x.js y.js
$ yarn pretty-quick --staged
yarn run v1.3.2
$ /Users/azz/code/pretty-quick-issue-30/node_modules/.bin/pretty-quick --staged
🔍 Finding changed files since git revision null.
🎯 Found 2 changed files.
✍️ Fixing up y.js.
✅ Everything is awesome!
✨ Done in 0.51s. |
I have the same issue. |
I'm using error Command failed.
Exit code: 1
Command: git
Arguments: commit -m v0.0.108
Directory: ...
Output:
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 6c06227.
🎯 Found 1 changed file.
✍️ Fixing up package.json.
✗ Found partially staged file package.json.
✗ Partially staged files were fixed up. Please update stage before committing.
husky > pre-commit hook failed (add --no-verify to bypass)
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Multiple reports, reverting last change in #32. Will diagnose further once the release (1.5.1) is out. |
@marc1404 what was the status of |
1.5.1 will fix the issue https://github.com/azz/pretty-quick/releases/tag/v1.5.1 |
If anyone is able to describe reproduction steps we should be able to fix this one and re-add the feature. |
Thanks for reacting so quickly on this issue! Here is my test without* the $ git diff
diff --git a/layouts/default.vue b/layouts/default.vue
index 29290c1..4b73e9d 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -29,6 +29,7 @@
import { Navbar, Sidebar, sidebarService } from '~/src/layout';
const test = '';
+ const test2 = '';
export default {
name: 'DefaultLayout',
diff --git a/package.json b/package.json
index e23dd53..cf38a12 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"scripts": {
- "precommit": "pretty-quick --staged",
+ "precommit": "pretty-quick",
$ git commit -m "test"
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 4d90c6c.
🎯 Found 1 changed file.
✍️ Fixing up layouts/default.vue.
✅ Everything is awesome! Here is the output with the $ git diff
diff --git a/layouts/default.vue b/layouts/default.vue
index 29290c1..4b73e9d 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -29,6 +29,7 @@
import { Navbar, Sidebar, sidebarService } from '~/src/layout';
const test = '';
+ const test2 = '';
export default {
name: 'DefaultLayout',
$ git add .
$ git commit -m "test"
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 50d4fcf.
🎯 Found 1 changed file.
✍️ Fixing up layouts/default.vue.
✗ Found partially staged file layouts/default.vue.
✗ Partially staged files were fixed up. Please update stage before committing.
husky > pre-commit hook failed (add --no-verify to bypass) |
|
Okay, I reverted back to $ git diff
$ git diff --staged
diff --git a/layouts/default.vue b/layouts/default.vue
index d493edc..e07165e 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -28,6 +28,8 @@
<script>
import { Navbar, Sidebar, sidebarService } from '~/src/layout';
+ const test = '';
+
export default {
name: 'DefaultLayout',
components: {
diff --git a/package.json b/package.json
index a5ad677..2bbe73d 100644
--- a/package.json
+++ b/package.json
@@ -71,7 +71,7 @@
"minimist": "1.2.0",
"node-notifier": "5.2.1",
"prettier": "1.12.1",
- "pretty-quick": "1.5.1"
+ "pretty-quick": "1.5.0"
},
"engines": {
"node": ">=9.0.0",
diff --git a/yarn.lock b/yarn.lock
index 3123e2d..a0ba45b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4491,9 +4491,9 @@ pretty-ms@3.1.0:
parse-ms "^1.0.0"
plur "^2.1.2"
-pretty-quick@1.5.1:
- version "1.5.1"
- resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.5.1.tgz#b36bb4fe7cdb04ed5f4ba4ba530d609cb3be4ac2"
+pretty-quick@1.5.0:
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.5.0.tgz#304853ece7f8cb56bec74ba3ccd978037e7f2117"
dependencies:
chalk "^2.3.0"
execa "^0.8.0"
$ git commit -m "test"
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 018df2d.
🎯 Found 2 changed files.
✍️ Fixing up layouts/default.vue.
✗ Found partially staged file layouts/default.vue.
✗ Partially staged files were fixed up. Please update stage before committing.
husky > pre-commit hook failed (add --no-verify to bypass) |
Okay, I have a reproduction and I think I have line-of-sight on the issue. I'll keep you posted. |
Thanks for investigating! |
The git command checking for unstaged changes should not have been including a revision.
Okay, I pushed a PR to resolve the issue. A couple of learnings coming out of this experience:
|
Maybe something like isomorphic git could be used for git integration tests? |
Thank you @mpareja. Reason I couldn't repro is I tried from a fresh git repo, whose 1.6.0 will re-introduce this feature. |
The new version is out. Can you give that a go @MatthewMi11er, @marc1404 and @rdiazv ? |
@mpareja Working out perfectly so far on |
It works great! 🎉 |
|
Removing Error Message:
|
I'm getting this error in v2.0.1 when I have no partially staged files, just one file in staging |
Same for me. In v2.0.1 I'm getting this error om some random files. If i change to v1.5.1 it's working. |
Same on 2.0.1 |
Im facing the same problem with 2.0.1 |
After updating to 3.1.0 the issue is gone |
Same problem on 3.1.3 |
Am I misunderstanding what is meant by partially staged files? If I stage all my changes for a commit and one of those files requires formatting, then when I run
pretty-quick --staged
it errors, doesn't restaged the file and tells me itFound partially staged file
. On the other hand if no staged files required formatting then it proceeds without error.I would have not expected this behavior unless one of the changed files had remaining unstaged changes prior to running
pretty-quick
The text was updated successfully, but these errors were encountered: