scripts: getver.sh: append Git short hash to revision
authorJo-Philipp Wich <jo@mein.io>
Fri, 2 Dec 2016 11:07:19 +0000 (12:07 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 2 Dec 2016 15:38:55 +0000 (16:38 +0100)
Change getver.sh to append a short Git commit hash to the end of the artifical
revision number. This way we still have order- and comparable commit numbers
but also a direct relation to the Git commit.

The new output format will look like "r2400+2-882472e" for dirty trees or like
"r2402-882472e" for clean ones.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
scripts/getver.sh

index d5f29864b57b24b2dab693ad88c58da4b4dcc623..ecf048f4c1c88b308295e5d9d79e34bc2f70a12e 100755 (executable)
@@ -40,7 +40,7 @@ try_git() {
                        REV="${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
                fi
 
-               REV="${REV:+r$REV}"
+               REV="${REV:+r$REV-$(git log --format="%h" -1)}"
                ;;
        esac