Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
# SPDX-License-Identifier: Apache-2.0

use flake
pre-commit install
pre-commit install -t prepare-commit-msg
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,11 @@ repos:
- id: markdownlint
exclude: ^paper\.md$
args: [-r, "~MD013,~MD033,~MD024"]

- repo: local
hooks:
- id: dco-hook
name: check DCO
entry: ./tools/pre-commit-dco-hook.sh
language: script
stages: [prepare-commit-msg]
17 changes: 17 additions & 0 deletions tools/pre-commit-dco-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
#
# Append a Signed-off-by line to all git commit messages
#
# Author: Philipp Jungkamp <philipp.jungkamp@rwth-aachen.de>
# SPDX-FileCopyrightText: 2014-2025 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

MESSAGE_FILE="$1"
GIT_AUTHOR="$(git var GIT_AUTHOR_IDENT | sed -n 's|^\(.*>\).*$|\1|p')"
SIGNOFF="Signed-off-by: $GIT_AUTHOR"

if ! grep --quiet --fixed-strings --line-regexp "$SIGNOFF" "$MESSAGE_FILE" ; then
printf "\n%s" "$SIGNOFF" >> "$MESSAGE_FILE"
fi

exit 0