Skip to content

Commit 5729fe5

Browse files
authored
Merge pull request #1252 from linonetwo/fix/version-on-global-install
fix: check git status before using git version tag
2 parents 5adcd47 + d18b89f commit 5729fe5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/lib/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ function getVersion () {
2525
// Obtain version from git
2626
const options = { cwd: __dirname, encoding: 'utf8' }
2727
const { stdout } = spawnSync('git', ['describe', '--tags'], options)
28+
const { stdout: gitStatusStdout } = spawnSync('git', ['status'], options)
2829
const version = stdout.trim()
29-
if (version === '') {
30+
if (version === '' || gitStatusStdout.match('Not currently on any branch')) {
3031
throw new Error('No git version here')
3132
}
3233
return version

0 commit comments

Comments
 (0)