Fix unescaped line break in git output

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-08-15 00:16:46 +02:00
parent 3175fe18b2
commit 8b69ac1bcf
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -27,7 +27,7 @@ exports.toIntegerConfig = function toIntegerConfig (configValue) {
exports.getGitCommit = function getGitCommit (repodir) { exports.getGitCommit = function getGitCommit (repodir) {
try { try {
// prefer using git to get the current ref, as poking in .git is very fragile // prefer using git to get the current ref, as poking in .git is very fragile
return require('child_process').execSync('git rev-parse HEAD') return require('child_process').execSync('git rev-parse HEAD').replace('\n', '')
} catch (e) { } catch (e) {
// there was an error running git, try to parse refs ourselves // there was an error running git, try to parse refs ourselves
if (!fs.existsSync(repodir + '/.git/HEAD')) { if (!fs.existsSync(repodir + '/.git/HEAD')) {