Skip to content

Commit 21a7766

Browse files
author
royriojas
committed
ENH: Make onDirtyState default to stash
**BREAKING CHANGE:** Well not really breaking, but this change the previous default value from `ask` to `stash` when the tree contains files that are modified but not staged or untracked
1 parent 745e8b5 commit 21a7766

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ or as an object in a `custom.json` file or in `package.json` add the following s
4949
// fail => Simply refuse to push something when you have uncommited/untracked files
5050
// stash => If there are uncommited/untracked files stash them, do the push and restore the stash
5151
// This will also move untracked files into the stash
52-
"onDirtyState": "ask", // <== fail or stash,
52+
"onDirtyState": "ask", // <== ask, fail or stash. Default to stash
5353
"coloredOuput" : true // <== true or false. If ommited it will try to use the env variable `__CLIX_COLORED_OUTPUT__` (from `clix` module)
5454
}
5555
}
@@ -75,8 +75,8 @@ Usage: precommit -c [path/to/config/file] [install|remove]
7575
-v, --version Outputs the version number
7676
-q, --quiet Show only the summary info - default: false
7777
--colored-output Use colored output in logs
78-
-c, --config String Path to your `precommit` config, if not provided will try to use the `package.json` file in your current working directory, expecting an
79-
entry called `precommit`
78+
-c, --config String Path to your `precommit` config, if not provided will try to use the `package.json` file in your
79+
current working directory, expecting an entry called `precommit`
8080
```
8181

8282
**Note**: The `colored-output` in the cli is only for logs during installing/removing the hook.

hook/pre-commit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,11 @@ var main = function () {
404404

405405
if ( Array.isArray( precommitSection ) ) {
406406
tasks = precommitSection;
407-
onDirtyState = 'ask';
407+
onDirtyState = 'stash';
408408
} else {
409409
if ( precommitSection !== null && typeof precommitSection !== 'undefined' ) {
410410
tasks = precommitSection.tasks;
411-
onDirtyState = precommitSection.onDirtyState || 'ask';
411+
onDirtyState = precommitSection.onDirtyState || 'stash';
412412
}
413413
}
414414

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@
2929
],
3030
"onDirtyState": "ask"
3131
},
32-
"precommit": {
33-
"coloredOuput": true,
34-
"tasks": [
35-
"npm run verify --silent"
36-
],
37-
"onDirtyState": "ask"
38-
},
32+
"precommit": [
33+
"npm run verify --silent"
34+
],
3935
"bin": {
4036
"precommit": "./bin/cli.js"
4137
},

0 commit comments

Comments
 (0)