Skip to content
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

Use in empty git repository #32

Open
daurnimator opened this issue Nov 22, 2017 · 6 comments
Open

Use in empty git repository #32

daurnimator opened this issue Nov 22, 2017 · 6 comments

Comments

@daurnimator
Copy link

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)
@kurttheviking
Copy link
Owner

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?

@daurnimator
Copy link
Author

wrap in a try/catch and check for ENOENT?

@kurttheviking
Copy link
Owner

@daurnimator maybe; but what's expected? return null or an empty string?

@daurnimator
Copy link
Author

null I think? Probably same as if you're not in a git repository.

@septs
Copy link

septs commented Feb 18, 2020

https://github.com/NiceLabs/git-rev

Support empty-repository

@sunknudsen
Copy link

sunknudsen commented Mar 15, 2020

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants