diff options
author | June McEnroe <june@causal.agency> | 2020-12-27 18:45:04 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-12-27 18:45:04 -0500 |
commit | 6169012d588458b9dbbbea56528d5e3669596c80 (patch) | |
tree | fc28a97fede3b74ae2cb2e778ffd4c0ae59c637b /gen-version.sh | |
download | src-6169012d588458b9dbbbea56528d5e3669596c80.tar.gz src-6169012d588458b9dbbbea56528d5e3669596c80.zip |
Squashed 'www/git.causal.agency/cgit/' content from commit 02221fd3
git-subtree-dir: www/git.causal.agency/cgit git-subtree-split: 02221fd3fe523a3293d64e3359036e3a71d6fd7e
Diffstat (limited to 'gen-version.sh')
-rwxr-xr-x | gen-version.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gen-version.sh b/gen-version.sh new file mode 100755 index 00000000..80cf49af --- /dev/null +++ b/gen-version.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Get version-info specified in Makefile +V=$1 + +# Use `git describe` to get current version if we're inside a git repo +if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git' +then + V=$(git describe --abbrev=4 HEAD 2>/dev/null) +fi + +new="CGIT_VERSION = $V" +old=$(cat VERSION 2>/dev/null) + +# Exit if VERSION is uptodate +test "$old" = "$new" && exit 0 + +# Update VERSION with new version-info +echo "$new" > VERSION +cat VERSION |