Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
afbd6680
Commit
afbd6680
authored
5 years ago
by
Auke Klazema
Browse files
Options
Downloads
Patches
Plain Diff
SW-773
: Remove one hook and fix the other hook
parent
a7b36b96
No related branches found
No related tags found
1 merge request
!8
Cobalt2 multithreading fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
support/hooks/pre-commit
+0
-36
0 additions, 36 deletions
support/hooks/pre-commit
with
0 additions
and
36 deletions
support/hooks/pre-commit
deleted
100644 → 0
+
0
−
36
View file @
a7b36b96
#! /usr/bin/env ruby
$regex
=
/^((fixes|task|story|issue)\s)?(#(\d+)|[a-zA-Z]+-(\d)+):/i
# Simple function, just for ease of testing
def
parse_message
(
msg
,
re
)
if
not
re
.
match
(
msg
)
return
false
else
return
true
end
end
# enforced custom commit message format
def
check_message_format
missed_revs
=
`git rev-list
#{
$rev_old
}
..
#{
$rev_new
}
`
.
split
(
"
\n
"
)
missed_revs
.
each
do
|
rev
|
message
=
`git cat-file commit
#{
rev
}
| sed '1,/^$/d'`
if
not
parse_message
(
message
,
$regex
)
STDERR
.
puts
(
"[pre-receive hook] Your commit
#{
rev
}
was rejected."
)
STDERR
.
puts
(
"[pre-receive hook] Commit message must start with a JIRA task ID,"
\
" or
\"
Task
\"
,
\"
Story
\"
,
\"
Issue
\"
or
\"
Fixes
\"
, followed by an issue ID."
)
STDERR
.
puts
(
"[pre-receive hook] For example:
\"
Task #42: Fixed bug
\"
or
\"
SW-22334: Fixed bug
\"
"
)
STDERR
.
puts
(
"[pre-receive hook] Your commit message was: "
+
message
)
exit
1
end
end
end
# The "main" method ... when executing this file:
# Only run this if the file itself is being executed
if
__FILE__
==
$0
$rev_old
,
$rev_new
,
$ref
=
STDIN
.
read
.
split
(
" "
)
check_message_format
end
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