Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
xml-validation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vaclab
xml-validation
Commits
817b5598
Commit
817b5598
authored
3 years ago
by
Rolf Niepraschk
Browse files
Options
Downloads
Patches
Plain Diff
adding file "pre-push" to the repository
parent
4d7a9388
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+6
-31
6 additions, 31 deletions
README.md
pre-push
+23
-0
23 additions, 0 deletions
pre-push
with
29 additions
and
31 deletions
README.md
+
6
−
31
View file @
817b5598
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
pre-push
0 → 100755
+
23
−
0
View file @
817b5598
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment