From 3e9cb1d4fdf4807595e47eb6c6c33e0cb8fc6aaa Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Thu, 11 Mar 2021 09:39:18 -0500 Subject: [PATCH] Desktop: remove branch name in detached head state (#4636) --- packages/app-desktop/tools/compile-package-info.js | 3 +-- packages/lib/versionInfo.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app-desktop/tools/compile-package-info.js b/packages/app-desktop/tools/compile-package-info.js index 11f439f29..8f1c7aa29 100644 --- a/packages/app-desktop/tools/compile-package-info.js +++ b/packages/app-desktop/tools/compile-package-info.js @@ -27,8 +27,7 @@ module.exports = async function() { // Use stdio: 'pipe' so that execSync doesn't print error directly to stdout branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim(); hash = execSync('git log --pretty="%h" -1', { stdio: 'pipe' }).toString().trim(); - // The builds in CI are done from a 'detached HEAD' state - if (branch === 'HEAD') branch = 'master'; + // The builds in CI are done from a 'detached HEAD' state, thus the branch name will be 'HEAD' for Travis builds. } catch (err) { // Don't display error object as it's a "fatal" error, but // not for us, since is it not critical information diff --git a/packages/lib/versionInfo.ts b/packages/lib/versionInfo.ts index 65c36d8dd..2cb08b479 100644 --- a/packages/lib/versionInfo.ts +++ b/packages/lib/versionInfo.ts @@ -7,6 +7,7 @@ export default function versionInfo(packageInfo: any) { let gitInfo = ''; if ('git' in p) { gitInfo = _('Revision: %s (%s)', p.git.hash, p.git.branch); + if (p.git.branch === 'HEAD') gitInfo = gitInfo.slice(0, -7); } const copyrightText = 'Copyright © 2016-YYYY Laurent Cozic'; const now = new Date();