prepare-commit-msg 473 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. # see https://stackoverflow.com/questions/15015894/git-add-signed-off-by-line-using-format-signoff-not-working/46536244#46536244
  3. NAME=$(git config user.name)
  4. EMAIL=$(git config user.email)
  5. if [ -z "$NAME" ]; then
  6. echo "empty git config user.name"
  7. exit 1
  8. fi
  9. if [ -z "$EMAIL" ]; then
  10. echo "empty git config user.email"
  11. exit 1
  12. fi
  13. git interpret-trailers --if-exists doNothing --trailer \
  14. "Signed-off-by: $NAME <$EMAIL>" \
  15. --in-place "$1"