-
-
Notifications
You must be signed in to change notification settings - Fork 412
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
feat: use git stashes for gitWorkflow #663
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
bfd2adc
feat: use git stashes for gitWorkflow
iiroj bdf0faf
ci: print git version number in AppVeyor
iiroj 5c165fa
refactor: simplify gitWorkflow by creating only one stash
iiroj b008ab8
test: update test for restoring changes
iiroj 30939b9
fix: retry failing apply with 3-way merge
iiroj 8ec8bfb
refactor: improvements
iiroj 340c1c2
refactor: GitWorkflow is a class
iiroj 31e440e
test: increase jest timeout for slow CI runners
iiroj 080f1c6
fix: try applying unstaged changes before handling errors
iiroj e8d5e27
test: add some runAll tests
iiroj 7b798fd
test: add test for failing merge conflict resolution
iiroj 89e6de0
refactor: use execa.command to avoid parsing of commands
iiroj 959d9d9
fix: gitWorkflow handles active merge mode
iiroj 66381f0
test: move mock files inside test directory
iiroj e535e76
test: rework usage of tmp module
iiroj d087155
refactor: no need to use path.resolve since path is normalized
iiroj af77588
refactor: check for merge using fs.access before fs.readfile
iiroj 3d8c753
refactor: move file operations to separate file
iiroj 45688b2
test: scope global jest timeout to only runAll.unmocked.spec
iiroj 6239830
test: remove non-functioning, throwing tests
iiroj d2e4253
refactor: rename src/ to lib/ since it's not compiled
iiroj dded921
refactor: improve long argument warning indentation
iiroj 647abd7
refactor: show helpful warning about git failures
iiroj 05f53b3
test: do not use tmp for creation of tmp directories
iiroj b591ba8
test: add mock console
iiroj 19e6c11
test: further increase timeout for long test
iiroj d20c5be
fix: keep untracked files around by backing them up
iiroj 0018949
refactor: improvements based on PR review
iiroj e3da610
docs: remove bit about next release
iiroj 50afea0
fix: workaround for stashing deleted files for git < 2.23
iiroj 35b0616
test: should work when amending previous commit with unstaged changes
iiroj de82960
test: improve coverage of gitWorkflow
iiroj 7d0379d
feat: automatically stage task modifications
iiroj 4014f3c
feat: warn when task contains "git add"
iiroj 473b93b
test: add test for supplying object config via node api
iiroj 0111f48
fix: correctly restore untracked files from backup stash
iiroj 2b57db0
fix: prevent Listr from hiding git add warning
iiroj File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ cache: | |
test_script: | ||
- node --version | ||
- yarn --version | ||
- git --version | ||
- yarn test | ||
|
||
branches: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"*.{js,json,md}": ["prettier --write", "git add"], | ||
"*.js": ["npm run lint:base --fix", "git add"], | ||
".*{rc, json}": ["jsonlint --in-place", "git add"] | ||
"*.{js,json,md}": "prettier --write", | ||
"*.js": "npm run lint:base --fix", | ||
".*{rc, json}": "jsonlint --in-place" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict' | ||
|
||
const debug = require('debug')('lint-staged:git') | ||
const execa = require('execa') | ||
|
||
module.exports = async function execGit(cmd, options = {}) { | ||
debug('Running git command', cmd) | ||
try { | ||
const { stdout } = await execa('git', [].concat(cmd), { | ||
...options, | ||
cwd: options.cwd || process.cwd() | ||
}) | ||
return stdout | ||
} catch ({ all }) { | ||
throw new Error(all) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict' | ||
|
||
const debug = require('debug')('lint-staged:file') | ||
const fs = require('fs') | ||
|
||
/** | ||
* Check if file exists and is accessible | ||
* @param {String} filename | ||
* @returns {Promise<Boolean>} | ||
*/ | ||
module.exports.checkFile = filename => | ||
new Promise(resolve => { | ||
debug('Trying to access `%s`', filename) | ||
fs.access(filename, fs.constants.R_OK, error => { | ||
if (error) { | ||
debug('Unable to access file `%s` with error:', filename) | ||
debug(error) | ||
} else { | ||
debug('Successfully accesses file `%s`', filename) | ||
} | ||
|
||
resolve(!error) | ||
}) | ||
}) | ||
|
||
/** | ||
* @param {String} filename | ||
* @returns {Promise<Buffer|Null>} | ||
*/ | ||
module.exports.readBufferFromFile = filename => | ||
new Promise(resolve => { | ||
debug('Reading buffer from file `%s`', filename) | ||
fs.readFile(filename, (error, file) => { | ||
debug('Done reading buffer from file `%s`!', filename) | ||
resolve(file) | ||
}) | ||
}) | ||
|
||
/** | ||
* @param {String} filename | ||
* @param {Buffer} buffer | ||
* @returns {Promise<Void>} | ||
*/ | ||
module.exports.writeBufferToFile = (filename, buffer) => | ||
new Promise(resolve => { | ||
debug('Writing buffer to file `%s`', filename) | ||
fs.writeFile(filename, buffer, () => { | ||
debug('Done writing buffer to file `%s`!', filename) | ||
resolve() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be removed completely perhaps?
@returns {array} - Array of tasks
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or even better with a shape of the task. but that's a nit