3 ## Automatically generate a file with git branch and revision info
6 ## [master]v2.0.0-beta-191(a830382)
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'
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