aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgithooks/commit-msg8
1 files changed, 7 insertions, 1 deletions
diff --git a/githooks/commit-msg b/githooks/commit-msg
index c25b0a0..df2dc8f 100755
--- a/githooks/commit-msg
+++ b/githooks/commit-msg
@@ -133,4 +133,10 @@ fi
# Substitute '###'.
# '$1' is passed by Git, the file name that holds commit message.
-sed -i '' -e "s|###|${issue_number}|g" "${1}"
+if sed --version >/dev/null 2>&1; then
+ # GNU sed: -i takes no arguments.
+ sed -i -e "s|###|${issue_number}|g" "$1"
+else
+ # BSD sed: -i takes an extension of backup file.
+ sed -i '' -e "s|###|${issue_number}|g" "$1"
+fi