diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-08 16:20:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-08 16:20:37 +0900 |
| commit | f01dac9ba8b618ca74fdf02d275ab5df57c71721 (patch) | |
| tree | b9d7f143515c5de3938ee45db28d77016573685c /githooks/commit-msg | |
| parent | ab8d3f1544d5c0930dc76e6c76d3051df2dcd9ab (diff) | |
| download | dotfiles-f01dac9ba8b618ca74fdf02d275ab5df57c71721.tar.gz dotfiles-f01dac9ba8b618ca74fdf02d275ab5df57c71721.tar.zst dotfiles-f01dac9ba8b618ca74fdf02d275ab5df57c71721.zip | |
git/hooks: fix commit-msg hook so that it works with GNU sed
Diffstat (limited to 'githooks/commit-msg')
| -rwxr-xr-x | githooks/commit-msg | 8 |
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 |
