Last active
November 13, 2015 04:44
-
-
Save akonwi/68cec63c3a2e176f2c5e 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
git.cmd = (args, options={}) -> | |
new Promise (resolve, reject) -> | |
output = '' | |
try | |
new BufferedProcess | |
command: atom.config.get('git-plus.gitPath') ? 'git' | |
args: args | |
options: options | |
stdout: (data) -> output += data.toString() | |
stderr: (data) -> reject data.toString() | |
exit: (code) -> resolve output | |
catch | |
notifier.addError 'Git Plus is unable to locate the git command. Please ensure process.env.PATH can access git.' | |
reject "Couldn't find git" | |
# New usage | |
stagedFiles = (repo) -> | |
args = ['diff-index', '--cached', 'HEAD', '--name-status', '-z'] | |
git.cmd(args, cwd: repo.getWorkingDirectory()) | |
.then (data) -> # handle data | |
.catch (error) -> # handle error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment