]> git.ipfire.org Git - thirdparty/systemd.git/blame - tools/meson-vcs-tag.sh
logind: when we cannot attach a passed fd to a device, close it
[thirdparty/systemd.git] / tools / meson-vcs-tag.sh
CommitLineData
dcb905b6 1#!/bin/bash
681bd2c5
ZJS
2
3set -eu
4set -o pipefail
5
e4d5753b 6dir="$1"
e1ca734e
ZJS
7tag="$2"
8fallback="$3"
9
10if [ -n "$tag" ]; then
11 echo "$tag"
12 exit 0
13fi
681bd2c5 14
e4d5753b
ZJS
15# Apparently git describe has a bug where it always considers the work-tree
16# dirty when invoked with --git-dir (even though 'git status' is happy). Work
17# around this issue by cd-ing to the source directory.
18cd "$dir" && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"