Use in empty git repository
When used in an empty git repository I get:
Module build failed: Error: ENOENT: no such file or directory, open '/home/daurnimator/myproject/.git/packed-refs'
at Object.fs.openSync (fs.js:663:18)
at Object.fs.readFileSync (fs.js:568:33)
at Object.long (/home/daurnimator/myproject/node_modules/git-rev-sync/index.js:109:31)
yeah; that's a known issue that I haven't found a solid "fix" for yet -- do you have any ideas? if so, would you like to submit a PR?
wrap in a try/catch and check for ENOENT?
@daurnimator maybe; but what's expected? return null or an empty string?
null I think? Probably same as if you're not in a git repository.
https://github.com/NiceLabs/git-rev
Support empty-repository
@kurttheviking I also believe this package should have a feature (or default) to return null instead of throwing the following errors (or any other error related to git not being fully initialized).
Error: [git-rev-sync] no git repository found
Error: ENOENT: no such file or directory