Skip to content
Snippets Groups Projects
Commit 817b5598 authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

adding file "pre-push" to the repository

parent 4d7a9388
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
pre-push 0 → 100755
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment