From 96b1ba4b04478a14c42ff50bb8510ed63f83ff18 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Tue, 17 Mar 2020 06:13:36 +0300 Subject: [PATCH] Add git hooks to tools - Place these in your .git/hooks/ directory --- tools/get_version.bat | 2 +- tools/get_version.sh | 4 +++- tools/hooks/post-checkout | 2 ++ tools/hooks/post-commit | 2 ++ tools/hooks/post-merge | 2 ++ tools/hooks/post-rewrite | 2 ++ 6 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tools/hooks/post-checkout create mode 100644 tools/hooks/post-commit create mode 100644 tools/hooks/post-merge create mode 100644 tools/hooks/post-rewrite diff --git a/tools/get_version.bat b/tools/get_version.bat index 3d2737d..72f2562 100644 --- a/tools/get_version.bat +++ b/tools/get_version.bat @@ -1,4 +1,4 @@ @echo off ( -git log -1 --pretty="format:{\"commit\": \"%%H\", \"commit_short\": \"%%h\", \"version\": \"%%ad\", \"url\": \"https://github.com/bui/taiko-web/\"}" --date="format:%%y.%%m.%%d" +git log -1 --pretty="format:{\"commit\": \"%%H\", \"commit_short\": \"%%h\", \"version\": \"%%ad\"}" --date="format:%%y.%%m.%%d" ) > ../version.json diff --git a/tools/get_version.sh b/tools/get_version.sh index 8d46c64..13ee916 100755 --- a/tools/get_version.sh +++ b/tools/get_version.sh @@ -1 +1,3 @@ -git log -1 --pretty="format:{\"commit\": \"%H\", \"commit_short\": \"%h\", \"version\": \"%ad\", \"url\": \"https://github.com/bui/taiko-web/\"}" --date="format:%y.%m.%d" > ../version.json +#!/bin/bash +toplevel=$( git rev-parse --show-toplevel ) +git log -1 --pretty="format:{\"commit\": \"%H\", \"commit_short\": \"%h\", \"version\": \"%ad\"}" --date="format:%y.%m.%d" > "$toplevel/version.json" diff --git a/tools/hooks/post-checkout b/tools/hooks/post-checkout new file mode 100644 index 0000000..12285a5 --- /dev/null +++ b/tools/hooks/post-checkout @@ -0,0 +1,2 @@ +#!/bin/bash +./tools/get_version.sh diff --git a/tools/hooks/post-commit b/tools/hooks/post-commit new file mode 100644 index 0000000..12285a5 --- /dev/null +++ b/tools/hooks/post-commit @@ -0,0 +1,2 @@ +#!/bin/bash +./tools/get_version.sh diff --git a/tools/hooks/post-merge b/tools/hooks/post-merge new file mode 100644 index 0000000..12285a5 --- /dev/null +++ b/tools/hooks/post-merge @@ -0,0 +1,2 @@ +#!/bin/bash +./tools/get_version.sh diff --git a/tools/hooks/post-rewrite b/tools/hooks/post-rewrite new file mode 100644 index 0000000..12285a5 --- /dev/null +++ b/tools/hooks/post-rewrite @@ -0,0 +1,2 @@ +#!/bin/bash +./tools/get_version.sh