Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
83930a06
Unverified
Commit
83930a06
authored
7 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
dist: add commit message length checker
parent
7745060a
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
dist/tools/ci/build_and_test.sh
+1
-0
1 addition, 0 deletions
dist/tools/ci/build_and_test.sh
dist/tools/commit-msg/check.sh
+48
-0
48 additions, 0 deletions
dist/tools/commit-msg/check.sh
with
49 additions
and
0 deletions
dist/tools/ci/build_and_test.sh
+
1
−
0
View file @
83930a06
...
...
@@ -82,6 +82,7 @@ then
run ./dist/tools/ci/print_toolchain_versions.sh
run ./dist/tools/commit-msg/check.sh
${
CI_BASE_BRANCH
}
run ./dist/tools/whitespacecheck/check.sh
${
CI_BASE_BRANCH
}
DIFFFILTER
=
"MR"
ERROR_EXIT_CODE
=
0 run ./dist/tools/licenses/check.sh
DIFFFILTER
=
"AC"
run ./dist/tools/licenses/check.sh
...
...
This diff is collapsed.
Click to expand it.
dist/tools/commit-msg/check.sh
0 → 100755
+
48
−
0
View file @
83930a06
#!/bin/sh
# Copyright 2017 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
MSG_MAX_LENGTH
=
50
MSG_STRETCH_LENGTH
=
72
# If no branch but an option is given, unset BRANCH.
# Otherwise, consume this parameter.
BRANCH
=
"
${
1
}
"
if
echo
"
${
BRANCH
}
"
|
grep
-q
'^-'
;
then
if
[
$(
git rev-parse
--abbrev-ref
HEAD
)
!=
"master"
]
;
then
BRANCH
=
"master"
else
BRANCH
=
""
fi
else
if
[
-n
"
${
BRANCH
}
"
]
;
then
shift
1
fi
fi
# select HEAD, if no branch is given
if
[
-z
"
${
BRANCH
}
"
]
;
then
BRANCH
=
$(
git rev-list HEAD |
tail
-n
1
)
fi
ERROR
=
"
$(
git log
\
--no-merges
--pretty
=
format:
'%s'
$(
git merge-base
${
BRANCH
}
HEAD
)
..HEAD |
\
while
read
msg
;
do
msg_length
=
$(
echo
"
${
msg
}
"
|
awk
'{print length($0)}'
)
if
[
${
msg_length
}
-gt
${
MSG_MAX_LENGTH
}
]
;
then
echo
"Commit message is longer than
${
MSG_MAX_LENGTH
}
characters:"
>
&2
echo
"
\"
${
msg
}
\"
"
>
&2
if
[
${
msg_length
}
-gt
${
MSG_STRETCH_LENGTH
}
]
;
then
echo
"error"
fi
fi
done
)
"
if
[
-n
"
${
ERROR
}
"
]
;
then
exit
1
fi
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