diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Reorganize into source, assets and libraries
The C sources move to source/, the served files to assets/, the bundled
Git submodule to libraries/git and the filter scripts to extensions/.
Everything the build generates now lands in build/, so a clean is a
single remove and the tree stays clean.
Diffstat (limited to 'source/gen-version.sh')
| -rwxr-xr-x | source/gen-version.sh | 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 25 insertions, 0 deletions
diff --git a/source/gen-version.sh b/source/gen-version.sh new file mode 100755 index 0000000..23d0d0b --- /dev/null +++ b/source/gen-version.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# Writes a "CGIT_VERSION = ..." line to the output file (default: VERSION), +# for the build to include. Run from the project root so `git describe` acts +# on cgit rather than the bundled Git submodule. +# +# Usage: gen-version.sh <fallback-version> [output-file] + +V=$1 +OUT=${2:-VERSION} + +# Prefer `git describe` when run at the top of the cgit working tree. +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 "$OUT" 2>/dev/null) + +# Exit if the version is already up to date. +test "$old" = "$new" && exit 0 + +echo "$new" > "$OUT" +cat "$OUT" |
