Skip to content

Commit

Permalink
fix error message if trying to install in a non-git repo
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jan 9, 2020
1 parent e3f7fc8 commit 63d6776
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/installer/gitRevParse.ts
Expand Up @@ -9,13 +9,17 @@ export type GitRevParseResult = {
export function gitRevParse(cwd = process.cwd()): GitRevParseResult {
// https://github.com/typicode/husky/issues/580
// https://github.com/typicode/husky/issues/587
const result = cp.spawnSync(
const { status, stderr, stdout } = cp.spawnSync(
'git',
['rev-parse', '--show-prefix', '--git-common-dir'],
{ cwd }
)

const [prefix, gitCommonDir] = result.stdout
if (status !== 0) {
throw new Error(stderr.toString())
}

const [prefix, gitCommonDir] = stdout
.toString()
.split('\n')
.map(s => s.trim())
Expand Down

0 comments on commit 63d6776

Please sign in to comment.