diff --git a/README.md b/README.md index a44f0b8..8135bf5 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ setuptools.setup( - `{ccount}`: Number of commits since last tag or last `version_file` commit (see `count_commits_from_version_file`) +- `{full_sha}`: Full sha hash of the latest commit + - `{sha}`: First 8 characters of the sha hash of the latest commit - `{branch}`: Current branch name diff --git a/setuptools_git_versioning.py b/setuptools_git_versioning.py index 0e299b7..c31bdd3 100644 --- a/setuptools_git_versioning.py +++ b/setuptools_git_versioning.py @@ -167,7 +167,7 @@ def version_from_git(template=DEFAULT_TEMPLATE, dirty = is_dirty() head_sha = get_sha() - short_sha = head_sha[:8] if head_sha is not None else '' + full_sha = head_sha if head_sha is not None else '' ccount = count_since(tag_sha) on_tag = head_sha is not None and head_sha == tag_sha and not from_file branch = get_branch() @@ -179,4 +179,4 @@ def version_from_git(template=DEFAULT_TEMPLATE, else: t = template - return t.format(sha=short_sha, tag=tag, ccount=ccount, branch=branch) + return t.format(sha=full_sha[:8], tag=tag, ccount=ccount, branch=branch, full_sha=full_sha)