Created
November 13, 2015 04:35
-
-
Save akonwi/c101c7d25bc9c01646f3 to your computer and use it in GitHub Desktop.
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
gitStagedFiles = (repo, stdout) -> | |
files = [] | |
gitCmd | |
args: ['diff-index', '--cached', 'HEAD', '--name-status', '-z'] | |
cwd: repo.getWorkingDirectory() | |
stdout: (data) -> | |
files = _prettify(data) | |
stderr: (data) -> | |
# edge case of no HEAD at initial commit | |
if data.toString().includes "ambiguous argument 'HEAD'" | |
files = [1] | |
else | |
notifier.addError data.toString() | |
files = [] | |
exit: (code) -> stdout(files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment