open-cas-linux/tools/version2sha
Robert Baldyga 03d46f9b24 tools: Introduce version2sha helper tool
This tool translates Open CAS version tag into SHA in git repository.
Example:

$ ./tools/version2sha 21.06.0.0520.master
eaa2f54

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-21 12:28:08 +02:00

14 lines
270 B
Bash
Executable File

#!/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"