Browse Source

.hooks/prepare-commit-msg: Cleanup.

Instead of writing everything in the new commit template all at once in
a large here document, do it cleanly one command at a time.
main
Mathieu Arnold 6 months ago
parent
commit
d744a8de42
No known key found for this signature in database GPG Key ID: 29EB0902911D7E02
  1. 11
      .hooks/prepare-commit-msg

11
.hooks/prepare-commit-msg

@ -26,6 +26,7 @@ merge)
esac
outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
exec 3> "$outfile"
# Create a commit message template from three parts:
#
@ -38,8 +39,9 @@ outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
# line to the end of the file) which lists files staged for commit, files
# not staged, and untracked files.
cat >"$outfile" <<EOF
$(awk '1;/^#$/{exit}' "$1")
awk '1;/^#$/{exit}' "$1" >&3
cat >&3 <<EOF
# category/port: Subject goes here, max 50 cols -|
# <then a blank line>
# 72 columns --|
@ -65,7 +67,10 @@ $(awk '1;/^#$/{exit}' "$1")
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.
$(awk '/^#$/,EOF' "$1")
EOF
awk '/^#$/,EOF' "$1" >&3
exec 3>&-
mv "$outfile" "$1"

Loading…
Cancel
Save