fix: trim git info (#1746)

This commit is contained in:
Fangdun Tsai
2023-03-30 06:56:44 +08:00
committed by GitHub
parent 926bf49b26
commit 3180d961dd

View File

@@ -27,15 +27,10 @@ const getGitVersion = () => {
);
return null;
}
const VERSION = execSync('git describe --always --dirty')
.toString()
// remove empty line
.replace(/[\s\r\n]+$/, '');
return VERSION;
return execSync('git describe --always --dirty').toString().trimEnd();
};
const getCommitHash = (rev = 'HEAD') =>
execSync(`git rev-parse --short ${rev}`).toString();
execSync(`git rev-parse --short ${rev}`).toString().trimEnd();
export { getCommitHash, getGitVersion };