Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k-distribution/tests/regression-new/help/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TESTDIR=.
KRUN_FLAGS=--help
KOMPILE_FLAGS=--syntax-module TEST
PACKAGE_VERSION ?= $(shell cat ../../../../package/version)
GIT_REVISION=$(shell git describe --tags --long)
GIT_REVISION=$(shell ../../../../scripts/get-version-string.sh)
VERSION_REGEX="$(PACKAGE_VERSION)\|$(GIT_REVISION)"
KPARSE=${K_BIN}/kparse
KPARSE_GEN=${K_BIN}/kparse-gen
Expand Down
6 changes: 1 addition & 5 deletions kernel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,10 @@
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<exec executable="git"
<exec executable="../scripts/get-version-string.sh"
outputproperty="git.describe.out"
errorproperty="git.describe.err"
failifexecutionfails="false">
<arg value="describe" />
<arg value="--tags" />
<arg value="--dirty" />
<arg value="--long" />
</exec>
</target>
</configuration>
Expand Down
19 changes: 19 additions & 0 deletions scripts/get-version-string.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

MERGE_BASE=$(git merge-base master HEAD)
VERSION_TAG=$(git describe --contains --always "$MERGE_BASE" | sed 's/~.*//')

VERSION_STRING=$VERSION_TAG

DISTANCE=$(git rev-list --count "$MERGE_BASE"..HEAD)
VERSION_STRING+="-$DISTANCE"

SHA=$(git rev-parse --short HEAD)
VERSION_STRING+="-g$SHA"

DIRTY=$(git diff HEAD)
if [ -n "$DIRTY" ]; then
VERSION_STRING+=-dirty
fi

echo $VERSION_STRING