diff --git a/tools/version2sha b/tools/version2sha new file mode 100755 index 0000000..73e9bd0 --- /dev/null +++ b/tools/version2sha @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Copyright(c) 2021 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause-Clear +# + +VERSION=$1 +MERGE=$(echo "$VERSION" | cut -d. -f 4) +SHA=$(git log --merges --oneline | tac | sed "${MERGE}q;d" | cut -d " " -f 1) + +[[ -z "$SHA" ]] && exit 1 + +echo "$SHA"