File: get_git_version_string.sh

package info (click to toggle)
darktable 5.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 62,864 kB
  • sloc: ansic: 361,898; cpp: 102,446; xml: 19,813; lisp: 14,539; sh: 3,771; javascript: 3,264; perl: 1,925; python: 1,485; ruby: 975; makefile: 543; asm: 46; sql: 38; awk: 21
file content (25 lines) | stat: -rwxr-xr-x 520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

VERSION="$(git describe --tags --dirty --match release-*)"

if [ $? -eq 0 ] ;
then
  echo "$VERSION" | sed 's,^release-,,;s,-,+,;s,-,~,;'
  exit 0
fi

# with shallow clones, there may be no tags, so the first ^
# try to get version string will fail

# in that case let's at least return the commit hash

VERSION="$(git describe --always --dirty)"
if [ $? -eq 0 ] ;
then
  echo "$VERSION"
  exit 0
fi

# failed for some reason. let's just propagate
echo "unknown-version"
exit 0 # to not fail the whole build.