diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:00:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:00:47 +0000 |
commit | 2cb7e0aaedad73b076ea18c6900b0e86c5760d79 (patch) | |
tree | da68ca54bb79f4080079bf0828acda937593a4e1 /tools/meson-vcs-tag.sh | |
parent | Initial commit. (diff) | |
download | systemd-2cb7e0aaedad73b076ea18c6900b0e86c5760d79.tar.xz systemd-2cb7e0aaedad73b076ea18c6900b0e86c5760d79.zip |
Adding upstream version 247.3.upstream/247.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/meson-vcs-tag.sh')
-rwxr-xr-x | tools/meson-vcs-tag.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh new file mode 100755 index 0000000..1c3814d --- /dev/null +++ b/tools/meson-vcs-tag.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -eu +set -o pipefail + +dir="$1" +tag="$2" +fallback="$3" + +if [ -n "$tag" ]; then + echo "$tag" + exit 0 +fi + +# Apparently git describe has a bug where it always considers the work-tree +# dirty when invoked with --git-dir (even though 'git status' is happy). Work +# around this issue by cd-ing to the source directory. +cd "$dir" +# Check that we have either .git/ (a normal clone) or a .git file (a work-tree) +# and that we don't get confused if a tarball is extracted in a higher-level +# git repository. +[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback" |