Merge pull request #1546 from hedgedoc/fix/git_parsing

Fix unescaped line break in `git` output
This commit is contained in:
David Mehren 2021-08-15 00:22:12 +02:00 committed by GitHub
commit ed8119d314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,7 +27,7 @@ exports.toIntegerConfig = function toIntegerConfig (configValue) {
exports.getGitCommit = function getGitCommit (repodir) {
try {
// 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) {
// there was an error running git, try to parse refs ourselves
if (!fs.existsSync(repodir + '/.git/HEAD')) {