2019-04-21 05:51:20 +02:00
|
|
|
#!/usr/bin/env bash
|
2021-05-13 02:50:42 +02:00
|
|
|
set -eu
|
2019-04-21 05:51:20 +02:00
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
2021-05-13 02:50:42 +02:00
|
|
|
remote="$(git config zulip.zulipRemote)" || remote=upstream
|
|
|
|
{
|
|
|
|
git describe --always --tags --match='[0-9]*'
|
2022-10-13 07:44:45 +02:00
|
|
|
branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/main" "refs/remotes/$remote/*.x" "refs/remotes/$remote/*-branch")"
|
2021-05-13 02:50:42 +02:00
|
|
|
mapfile -t branches <<<"$branches"
|
|
|
|
if merge_base="$(git merge-base -- HEAD "${branches[@]}")"; then
|
|
|
|
git describe --always --tags --match='[0-9]*' -- "$merge_base"
|
|
|
|
fi
|
|
|
|
} >zulip-git-version
|