From d18b89fca0f9c4a8fa476db009759a12cf1bc6c9 Mon Sep 17 00:00:00 2001 From: linonetwo Date: Wed, 3 Jul 2019 15:14:37 +0800 Subject: [PATCH] fix: check git status before using git version tag This fixes the problem disribed in https://github.com/solid/node-solid-server/pull/1112 --- bin/lib/cli.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/lib/cli.js b/bin/lib/cli.js index 9131896d8..8cae2ceb6 100644 --- a/bin/lib/cli.js +++ b/bin/lib/cli.js @@ -25,8 +25,9 @@ function getVersion () { // Obtain version from git const options = { cwd: __dirname, encoding: 'utf8' } const { stdout } = spawnSync('git', ['describe', '--tags'], options) + const { stdout: gitStatusStdout } = spawnSync('git', ['status'], options) const version = stdout.trim() - if (version === '') { + if (version === '' || gitStatusStdout.match('Not currently on any branch')) { throw new Error('No git version here') } return version