]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Make gitrev more reliable
authorMatthew Ahrens <mahrens@delphix.com>
Mon, 22 Oct 2018 19:23:30 +0000 (12:23 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 22 Oct 2018 19:23:30 +0000 (12:23 -0700)
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 <mail@gmelikov.ru>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Thode <prometheanfire@gentoo.org>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #8034

scripts/make_gitrev.sh

index 757f00fbcf0e2046f3c34e2477094e59df9669ef..bab9be88d7342be0fc3b310ec3a7f00a330fb050 100755 (executable)
@@ -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)