Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
445
Issues
445
List
Boards
Labels
Service Desk
Milestones
Merge Requests
71
Merge Requests
71
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
1157db46
Commit
1157db46
authored
Dec 03, 2019
by
Tomek Mrugalski
🛰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#1042
] prepare-commit-msg hooks added
parent
6e9f5078
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
tools/git-hooks-install
tools/git-hooks-install
+23
-0
tools/git-hooks/prepare-commit-msg
tools/git-hooks/prepare-commit-msg
+15
-0
No files found.
tools/git-hooks-install
0 → 100755
View file @
1157db46
#!/bin/sh
# This script install user-side git commit hooks. You are supposed to run it
# only once for each repo (and very infrequently afterwards, once each time
# the git hooks change).
if
test
-d
.git
;
then
TOPDIR
=
.
else
TOPDIR
=
..
fi
GITDIR
=
${
TOPDIR
}
/.git
if
test
!
-d
${
GITDIR
}
;
then
echo
"ERROR: Could not find
${
GITDIR
}
in
${
TOPDIR
}
"
exit
-1
fi
echo
"Installing hooks in
${
GITDIR
}
/hooks"
mkdir
-p
${
GITDIR
}
/hooks
cp
${
TOPDIR
}
/tools/git-hooks/prepare-commit-msg
${
GITDIR
}
/hooks
chmod
u+x
${
GITDIR
}
/hooks/prepare-commit-msg
tools/git-hooks/prepare-commit-msg
0 → 100755
View file @
1157db46
#!/bin/sh
BRANCH
=
`
git branch |
grep
'^\*'
|
cut
-b3-
`
if
test
"
$BRANCH
"
==
"master"
;
then
echo
"ERROR: You are on branch
$BRANCH
"
echo
"ERROR: You are not allowed to commit to master directly. Please follow the process"
echo
"ERROR: (create issue, then MR for it, ...)"
exit
1
fi
BRANCH_NUMBER
=
`
git branch |
grep
-o
'^\* [0-9]*'
|
cut
-b3-
`
/bin/echo
-n
"[#
$BRANCH_NUMBER
] "
>
"
$1
.msg"
cat
"
$1
"
>>
"
$1
.msg"
mv
"
$1
.msg"
"
$1
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment