diff --git a/README.md b/README.md index 3ad1ff3d7dc96251a0f05c30eafb68fd68ee2fbe..364963ba1181df168706362c3a81f0e017d1aeed 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 0000000000000000000000000000000000000000..00ec1a4aef72c469edfe485869317e5cf5b09a25 --- /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