Added the git hooks to create the gitrevision.h include file
[ruwai.git] / hooks / post-merge
blobca5eb3932006b4357e58d6d3925367cb11693014
1 #!/bin/bash
3 ## Automatically generate a file with git branch and revision info
4 ##
5 ## Example:
6 ## [master]v2.0.0-beta-191(a830382)
7 ## Install:
8 ## cp git-create-revisioninfo-hook.sh .git/hooks/post-commit
9 ## cp git-create-revisioninfo-hook.sh .git/hooks/post-checkout
10 ## cp git-create-revisioninfo-hook.sh .git/hooks/post-merge
11 ## chmod +x .git/hooks/post-*
13 FILENAME='software/c++/ruwaicom/include/gitrevision.h'
15 exec 1>&2
16 branch=`git rev-parse --abbrev-ref HEAD`
17 shorthash=`git log --pretty=format:'%H' -n 1`
18 revcount=`git log --oneline | wc -l`
19 latesttag=`git describe --tags --abbrev=0`
21 GIT_VERSION="#define GIT_VERSION \"[$branch]$latesttag-$revcount($shorthash)\""
22 echo $GIT_VERSION > $FILENAME