Contrib: Helper scripts to receive the revision ID of the repository without running cmake. Need to be run inside the repository directory.
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#/bin/bash
|
||||
command=$(git describe --match init --abbrev=12)
|
||||
IFS="-"
|
||||
cmdarray=($command)
|
||||
|
||||
if [ "$1" != "-id" ] && [ "$1" != "-hash" ]; then
|
||||
echo "Usage: $0 <-id | -hash>"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "${cmdarray[1]}" == "" ] || [ "${cmdarray[2]}" == "" ]; then
|
||||
echo "Error: No valid revision information found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" == "-id" ]; then
|
||||
echo ${cmdarray[1]}
|
||||
elif [ "$1" == "-hash" ]; then
|
||||
echo ${cmdarray[2]:1}
|
||||
fi
|
||||
Reference in New Issue
Block a user