diff options
author | Daniël van de Giessen <daniel@dvdgiessen.nl> | 2025-07-10 18:57:55 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-09-10 17:00:37 +1000 |
commit | 9e89c752cb911ec9b4d3dd4d2edd6714e7ad09aa (patch) | |
tree | ffd3a1d49a35374bd93986c643fa29d81d8ea3c4 /py/makeversionhdr.py | |
parent | 1aaf6eddd82170209ca90586160ac265b9412229 (diff) |
py/makeversionhdr.py: Always abbreviate Git hashes to same length.
The Git hash is embedded in the version number. The hash is abbreviated by
Git. This commit changes the length of the Git hash abbreviation to a
fixed number, so that the length of the version string no longer varies
based on external factors (it can still vary, but will now be at least 10
characters).
This change is made because builds of the same MicroPython commit on
multiple machines were sometimes giving a version string with different
lengths, eg due to commits on other local branches having a clashing
abbreviated hash. This change may also help the code size report to be
more consistent, because it will less often be impacted by random changes
in the version string length, at the cost of always being a few bytes
longer.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Diffstat (limited to 'py/makeversionhdr.py')
-rw-r--r-- | py/makeversionhdr.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index 406a061a0..5c73501b3 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -31,7 +31,16 @@ def get_version_info_from_git(repo_path): # Note: git describe doesn't work if no tag is available try: git_tag = subprocess.check_output( - ["git", "describe", "--tags", "--dirty", "--always", "--match", "v[1-9].*"], + [ + "git", + "describe", + "--tags", + "--dirty", + "--always", + "--match", + "v[1-9].*", + "--abbrev=10", + ], cwd=repo_path, stderr=subprocess.STDOUT, universal_newlines=True, |