Skip to content

Commit

Permalink
Make gitrev more reliable
Browse files Browse the repository at this point in the history
In some build methods, the gitrev is unnecessarily set to "unknown".
We can improve this by changing the gitrev to use
`git describe --always --long --dirty`.

This gets the revision even when no tag matches (--always).  It prints
the hash even when it exactly matches a tag (--long).  And if there are
uncommitted changes, it appends "-dirty", rather than failing (--dirty).

Reviewed-by: George Melikov <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Thode <[email protected]>
Signed-off-by: Matthew Ahrens <[email protected]>
Closes openzfs#8034
  • Loading branch information
ahrens authored and Gregor Kopka committed Jan 7, 2019
1 parent 1d31cd0 commit 32de122
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scripts/make_gitrev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,5 @@ trap cleanup EXIT

# Check if git is installed and we are in a git repo.
git rev-parse --git-dir > /dev/null 2>&1
# Check if there are uncommitted changes
git diff-index --quiet HEAD
# Get the git current git revision
ZFS_GIT_REV=$(git describe 2>/dev/null)
ZFS_GIT_REV=$(git describe --always --long --dirty 2>/dev/null)

0 comments on commit 32de122

Please sign in to comment.