From 817b5598f849bc9a3aa9451cbb54ca90ffde159d Mon Sep 17 00:00:00 2001
From: Rolf Niepraschk <Rolf.Niepraschk@ptb.de>
Date: Fri, 30 Jul 2021 08:21:34 +0200
Subject: [PATCH] adding file "pre-push" to the repository

---
 README.md | 37 ++++++-------------------------------
 pre-push  | 23 +++++++++++++++++++++++
 2 files changed, 29 insertions(+), 31 deletions(-)
 create mode 100755 pre-push

diff --git a/README.md b/README.md
index 3ad1ff3..364963b 100644
--- a/README.md
+++ b/README.md
@@ -4,41 +4,16 @@ REST service for the validation of ```xml``` against a XML Schema (```xsd```).
 
 ## install & activate
 
-Create a file `.git/hooks/pre-push` in the GIT repository with the following 
-content:
+Create a file `.git/hooks/pre-push` inside the GIT repository:
 
-```shell
-#!/bin/bash
-
-# In the case of "git push --tags", writes the short tag value to the 
-# VERSION file in the top level directory of the Git repository
-
-toplevel=$(git rev-parse --show-toplevel)
-f=${toplevel}/VERSION
-
-if [ ! -f "$f" ]; then
-  touch "$f"
-  git add "$f"
-fi
-
-old_version=$(cat $f)
-new_version=$(git describe --tags --abbrev=0 2>/dev/null)
-
-if [ "$old_version" != "$new_version" ]; then
-  echo "$new_version" > "$f"
-  git commit -am "update to version '"$new_version"'"
-  git push origin # Is required because normal push does not necessarily happen
-fi
-
-exit 0
 ```
-
-Then make this file executable:
-
-```shell
-chmod 755 .git/hooks/pre-push
+cd .git/hooks/
+ln -s ln -sf ../../pre-push
 ```
 
+Note: In the case of "git push --tags", writes the short tag value to the 
+VERSION file in the top level directory of the Git repository.
+
 Do the following steps with root permission on the server installation:
 
 ```shell
diff --git a/pre-push b/pre-push
new file mode 100755
index 0000000..00ec1a4
--- /dev/null
+++ b/pre-push
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# In the case of "git push --tags", writes the short tag value to the 
+# VERSION file in the top level directory of the Git repository
+
+toplevel=$(git rev-parse --show-toplevel)
+f=${toplevel}/VERSION
+
+if [ ! -f "$f" ]; then
+  touch "$f"
+  git add "$f"
+fi
+
+old_version=$(cat $f)
+new_version=$(git describe --tags --abbrev=0 2>/dev/null)
+
+if [ "$old_version" != "$new_version" ]; then
+  echo "$new_version" > "$f"
+  git commit -am "update to version '"$new_version"'"
+  git push origin # Is required because normal push does not necessarily happen
+fi
+
+exit 0
-- 
GitLab