-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.sh
More file actions
executable file
·40 lines (31 loc) · 886 Bytes
/
version.sh
File metadata and controls
executable file
·40 lines (31 loc) · 886 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# Create a detailed version string for the program.
export TZ=UTC
RAW_TIME=`git log --date=local --pretty=format:%cd --date=raw -1 HEAD | awk -F" " '{print $1}'`
DATE=`date -u --date="@${RAW_TIME}" '+%Y.%m.%d-%TUTC'`
TAG=`git describe --tags $(git rev-list --tags --max-count=1)`
TAG_DIFF=`git log ${TAG}..HEAD --oneline | wc -l`
TAG_DIFF=`printf "%04d." ${TAG_DIFF}`
if [[ "$TAG_DIFF" == "0000." ]] ; then
# A percisely tagged version
V=" ${DATE}"
if [[ "$1" == "simple" ]] ; then
echo 0
exit
fi
else
# A pre-release
GITVER=g`git log --pretty=format:%h -1 HEAD`
V=".${TAG_DIFF}${GITVER}"
if [[ "$1" == "simple" ]] ; then
echo ${TAG_DIFF}${GITVER}
exit
fi
fi
echo """
{-# LANGUAGE OverloadedStrings #-}
module Gitomail.Version where
import Data.Text
version :: Text
version = \"${V}\"
"""