4 ## @brief Generate the Geeqie version number
6 ## This script is called from meson.build
8 ## If the current branch is "master" a revison number is generated of the form:
9 ## <n.m>+git<date of last commit>-<last commit hash>
10 ## where <n.m> is the most recent tag.
11 ## e.g. 1.7+git20220117-732b6935
13 ## If not on "master" or no .git directory, a revision number extracted
14 ## from the first line of the NEWS file is generated.
15 ## This situation will occur when compiling from a source .tar.
17 ## The first line of NEWS must be of the form:
23 branch=$(git rev-parse --abbrev-ref HEAD)
25 if [ "$branch" = "master" ]
28 # shellcheck disable=SC2046
29 set -- $(git tag --list v[1-9]* | tail -n 1 | tr -d 'v')
33 # patch_version=$3 # not used on master branch
35 printf '%s%s%s%s%s%s%s' "$major_version" "." "$minor_version" "+git" $(git log --max-count=1 --date=format:"%Y%m%d" --format="%ad") "-" $(git rev-parse --quiet --verify --short HEAD)
37 version=$(head -1 NEWS)
38 # shellcheck disable=SC2086
43 version=$(head -1 NEWS)
44 # shellcheck disable=SC2086