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

fix: cover case where git rev-parse returns null #1001

merged 1 commit into from Jul 6, 2021

fix: cover case where git rev-parse returns null #1001

merged 1 commit into from Jul 6, 2021


Copy link

@cmdcarini cmdcarini commented Jul 1, 2021

This resolves this issue by covering for the case that git rev-parse returns null, which may be the case in a CI Docker image that does not bundle the git cli

@@ -11,7 +11,7 @@ const git = (args: string[]): cp.SpawnSyncReturns<Buffer> =>

export function install(dir = '.husky'): void {
// Ensure that we're inside a git repository
if (git(['rev-parse']).status) {
Copy link

@typicode typicode Jul 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except, if I'm missing something, it's equivalent?

$ node
Welcome to Node.js v16.2.0.
Type ".help" for more information.
> 0 ? "a" : "b"
> 1 ? "a" : "b"

Copy link

@typicode typicode commented Jul 6, 2021

My bad, I didn't read correctly the title. null is returned if git command is not found.
Thanks for the PR!

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

Successfully merging this pull request may close these issues.

2 participants