Skip to content

Commit d2bb981

Browse files
committed
build: git description should always include commit
Remove '0' for commits with tags
1 parent 172195e commit d2bb981

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/pre_build_script.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import sys
2323
import os
24+
import re
2425
import argparse
2526
from subprocess import check_output, CalledProcessError
2627

@@ -63,8 +64,9 @@ def generate_version_file(version_git_dir):
6364
# Get the git description.
6465
print("#> Getting git description")
6566
try:
66-
git_description = check_output("git describe HEAD --always --tags", shell=True)
67+
git_description = check_output("git describe HEAD --always --tags --long", shell=True)
6768
git_description = git_description.decode().strip()
69+
git_description = re.sub(r'-0-g([0-9a-f]+)$', r'-g\1', git_description)
6870
except:
6971
print("#> ERROR: Failed to get git description, do you have git.exe in your PATH environment variable?")
7072
return 1

0 commit comments

Comments
 (0)