Skip to content

Commit 5ac7d8f

Browse files
committed
Add full_sha substitution support
1 parent 9684323 commit 5ac7d8f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ setuptools.setup(
8484

8585
- `{ccount}`: Number of commits since last tag or last `version_file` commit (see `count_commits_from_version_file`)
8686

87+
- `{full_sha}`: Full sha hash of the latest commit
88+
8789
- `{sha}`: First 8 characters of the sha hash of the latest commit
8890

8991
- `{branch}`: Current branch name

setuptools_git_versioning.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def version_from_git(template=DEFAULT_TEMPLATE,
167167

168168
dirty = is_dirty()
169169
head_sha = get_sha()
170-
short_sha = head_sha[:8] if head_sha is not None else ''
170+
full_sha = head_sha if head_sha is not None else ''
171171
ccount = count_since(tag_sha)
172172
on_tag = head_sha is not None and head_sha == tag_sha and not from_file
173173
branch = get_branch()
@@ -179,4 +179,4 @@ def version_from_git(template=DEFAULT_TEMPLATE,
179179
else:
180180
t = template
181181

182-
return t.format(sha=short_sha, tag=tag, ccount=ccount, branch=branch)
182+
return t.format(sha=full_sha[:8], tag=tag, ccount=ccount, branch=branch, full_sha=full_sha)

0 commit comments

Comments
 (0)