From 040f829f359d126aa7cf891389a01981b1dbf03b Mon Sep 17 00:00:00 2001 From: Stefan Mertl Date: Thu, 8 Feb 2018 12:21:09 +0100 Subject: [PATCH] Added the git hooks to create the gitrevision.h include file needed by ruwaicom. --- hooks/post-checkout | 22 ++++++++++++++++++++++ hooks/post-commit | 22 ++++++++++++++++++++++ hooks/post-merge | 22 ++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100755 hooks/post-checkout create mode 100755 hooks/post-commit create mode 100755 hooks/post-merge diff --git a/hooks/post-checkout b/hooks/post-checkout new file mode 100755 index 0000000..ca5eb39 --- /dev/null +++ b/hooks/post-checkout @@ -0,0 +1,22 @@ +#!/bin/bash + +## Automatically generate a file with git branch and revision info +## +## Example: +## [master]v2.0.0-beta-191(a830382) +## Install: +## cp git-create-revisioninfo-hook.sh .git/hooks/post-commit +## cp git-create-revisioninfo-hook.sh .git/hooks/post-checkout +## cp git-create-revisioninfo-hook.sh .git/hooks/post-merge +## chmod +x .git/hooks/post-* + +FILENAME='software/c++/ruwaicom/include/gitrevision.h' + +exec 1>&2 +branch=`git rev-parse --abbrev-ref HEAD` +shorthash=`git log --pretty=format:'%H' -n 1` +revcount=`git log --oneline | wc -l` +latesttag=`git describe --tags --abbrev=0` + +GIT_VERSION="#define GIT_VERSION \"[$branch]$latesttag-$revcount($shorthash)\"" +echo $GIT_VERSION > $FILENAME diff --git a/hooks/post-commit b/hooks/post-commit new file mode 100755 index 0000000..ca5eb39 --- /dev/null +++ b/hooks/post-commit @@ -0,0 +1,22 @@ +#!/bin/bash + +## Automatically generate a file with git branch and revision info +## +## Example: +## [master]v2.0.0-beta-191(a830382) +## Install: +## cp git-create-revisioninfo-hook.sh .git/hooks/post-commit +## cp git-create-revisioninfo-hook.sh .git/hooks/post-checkout +## cp git-create-revisioninfo-hook.sh .git/hooks/post-merge +## chmod +x .git/hooks/post-* + +FILENAME='software/c++/ruwaicom/include/gitrevision.h' + +exec 1>&2 +branch=`git rev-parse --abbrev-ref HEAD` +shorthash=`git log --pretty=format:'%H' -n 1` +revcount=`git log --oneline | wc -l` +latesttag=`git describe --tags --abbrev=0` + +GIT_VERSION="#define GIT_VERSION \"[$branch]$latesttag-$revcount($shorthash)\"" +echo $GIT_VERSION > $FILENAME diff --git a/hooks/post-merge b/hooks/post-merge new file mode 100755 index 0000000..ca5eb39 --- /dev/null +++ b/hooks/post-merge @@ -0,0 +1,22 @@ +#!/bin/bash + +## Automatically generate a file with git branch and revision info +## +## Example: +## [master]v2.0.0-beta-191(a830382) +## Install: +## cp git-create-revisioninfo-hook.sh .git/hooks/post-commit +## cp git-create-revisioninfo-hook.sh .git/hooks/post-checkout +## cp git-create-revisioninfo-hook.sh .git/hooks/post-merge +## chmod +x .git/hooks/post-* + +FILENAME='software/c++/ruwaicom/include/gitrevision.h' + +exec 1>&2 +branch=`git rev-parse --abbrev-ref HEAD` +shorthash=`git log --pretty=format:'%H' -n 1` +revcount=`git log --oneline | wc -l` +latesttag=`git describe --tags --abbrev=0` + +GIT_VERSION="#define GIT_VERSION \"[$branch]$latesttag-$revcount($shorthash)\"" +echo $GIT_VERSION > $FILENAME -- 2.11.4.GIT