summaryrefslogtreecommitdiffstats
path: root/tools/vcs-tag.sh
blob: 5da39cc539626da7d7dadee509c04ca946b91e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e

MODE="$1"

if ! [[ -d .git ]] || git describe --tags --exact-match &>/dev/null; then
    exit 0
fi

if [[ "$MODE" == "developer" ]]; then
    DIRTY="--dirty=^"
else
    DIRTY=""
fi

echo "-g$(git describe --abbrev=7 --match="" --always $DIRTY)"