Skip to content

Commit

Permalink
Add full_sha substitution support
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Feb 28, 2021
1 parent 9684323 commit 5ac7d8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions setuptools_git_versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)

0 comments on commit 5ac7d8f

Please sign in to comment.