From 5680c628b6718385bbd975b51ec2640aa7df226b Mon Sep 17 00:00:00 2001 From: wujinli <158149889+wujinli@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:36:03 +0800 Subject: [PATCH] fix: only remove the 'v' prefix from the git tag name (#45132) In the old version of get-version.js, it replaces the leading 'v', i.e. |output.stdout.toString().trim().replace(/^v/g, '')|. However, in the new version of get-git-version.py, it directly replaces all 'v'. Obviously, it does not conform to the original semantics. Although it will not affect the existing electron version calculation, it may affect other developers' customized git-tag-version, such as v0.0.0-dev.xxx, which will lose the 'v' of dev. --- script/get-git-version.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/get-git-version.py b/script/get-git-version.py index ca3bc07ba7b6..8b8035320305 100755 --- a/script/get-git-version.py +++ b/script/get-git-version.py @@ -2,6 +2,7 @@ import subprocess import os +import re # Find the nearest tag to the current HEAD. # This is equivalent to our old logic of "use a value in package.json" for the @@ -24,7 +25,8 @@ try: cwd=os.path.abspath(os.path.join(os.path.dirname(__file__), '..')), stderr=subprocess.PIPE, universal_newlines=True) - version = output.strip().replace('v', '') + # only remove the 'v' prefix from the tag name. + version = re.sub('^v', '', output.strip()) print(version) except Exception: # When there is error we print a null version string instead of throwing an