Compute the version number dynamically
[muddle-interpreter.git] / version.sh
1 # Copyright (C) 2018 Jason Self <j@jxself.org>
2 # Copying and distribution of this file, with or without
3 # modification, are permitted in any medium without royalty provided
4 # the copyright notice and this notice are preserved. This file is
5 # offered as-is, without any warranty.
6
7 branch=$(git rev-parse --abbrev-ref HEAD)
8 if [ "$branch" != "master" ]
9 then
10     git describe --tags
11 else
12     commit_count=$(git rev-list HEAD --count)
13     short_hash=$(git rev-parse --short HEAD)
14     echo "$branch-$commit_count-$short_hash"
15 fi