Created
August 25, 2018 23:25
-
-
Save yoshuawuyts/625e69c0c5bbb4ef39aff947a0ee2676 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
COMMIT_MSG_FILE=$1 # The git commit file. | |
COMMIT_SOURCE=$2 # The current commit message. | |
# Add "Signed-off-by: <user> <email>" to every commit message. | |
SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') | |
git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" | |
if test -z "$COMMIT_SOURCE"; then | |
/usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment