Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mkdocs-material
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Janne Mareike Koschinski
mkdocs-material
Commits
5b92b29d
Commit
5b92b29d
authored
Feb 18, 2017
by
squidfunk
Committed by
Martin Donath
Feb 18, 2017
Browse files
Options
Downloads
Patches
Plain Diff
Refactored output of git hooks
parent
c59d7760
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.githooks/post-merge/npm-update.sh
+1
-1
1 addition, 1 deletion
.githooks/post-merge/npm-update.sh
.githooks/pre-commit/branch.sh
+4
-2
4 additions, 2 deletions
.githooks/pre-commit/branch.sh
.githooks/pre-commit/lint.sh
+13
-2
13 additions, 2 deletions
.githooks/pre-commit/lint.sh
with
18 additions
and
5 deletions
.githooks/post-merge/npm-update.sh
+
1
−
1
View file @
5b92b29d
...
...
@@ -25,6 +25,6 @@ CHANGED="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
# Perform install and prune of NPM dependencies if package.json changed
if
$(
echo
"
$CHANGED
"
|
grep
--quiet
package.json
)
;
then
echo
"Hook[post-merge]:
Updating dependencies"
echo
-e
"
\x
1B[33m!
\x
1B[0m
Updating dependencies"
npm
install
&&
npm prune
fi
This diff is collapsed.
Click to expand it.
.githooks/pre-commit/branch.sh
+
4
−
2
View file @
5b92b29d
...
...
@@ -22,12 +22,14 @@
# Determine current branch
BRANCH
=
$(
git rev-parse
--abbrev-ref
HEAD
)
echo
"Hook[pre-commit]: Checking branch
"
MESSAGE
=
"Commits on master are only allowed via Pull Requests. Aborting.
"
# If we're on master, abort commit
if
[[
"
$BRANCH
"
==
"master"
]]
;
then
echo
"Commits on master are only allowed via Pull Requests. Aborting.
"
echo
-e
"
\x
1B[31m✗
\x
1B[0m Branch:
$BRANCH
-
\x
1B[31m
$MESSAGE
\x
1B[0m
"
exit
1
else
echo
-e
"
\x
1B[32m✓
\x
1B[0m Branch:
$BRANCH
"
fi
# We're good
...
...
This diff is collapsed.
Click to expand it.
.githooks/pre-commit/lint.sh
+
13
−
2
View file @
5b92b29d
...
...
@@ -22,6 +22,7 @@
# Patch file to store unindexed changes
PATCH_FILE
=
".working-tree.patch"
MESSAGE
=
"Terminated with errors"
# Revert changes that have been registered in the patch file
function
cleanup
{
...
...
@@ -46,6 +47,16 @@ FILES=$(git diff --cached --name-only --diff-filter=ACMR | \
# Run the check and print indicator
if
[
"
$FILES
"
]
;
then
echo
"Hook[pre-commit]: Running linter"
npm run lint
--silent
||
exit
1
npm run lint
--silent
# If we're on master, abort commit
if
[
$?
-gt
0
]
;
then
echo
-e
"
\x
1B[31m✗
\x
1B[0m Linter -
\x
1B[31m
$MESSAGE
\x
1B[0m"
exit
1
else
echo
-e
"
\x
1B[32m✓
\x
1B[0m Linter"
fi
fi
# We're good
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