diff options
author | Sebastien Devaux <sebastien.devaux@laposte.net> | 2019-01-04 15:29:24 +0100 |
---|---|---|
committer | Sebastien Devaux <sebastien.devaux@laposte.net> | 2019-01-04 15:29:24 +0100 |
commit | afbda3cc23282b6c37849048d33f9c9c12ef8fb8 (patch) | |
tree | 69dd0953bdd8d4882f648faff72126ca0423b4e4 /misc | |
parent | 1787f959ffed4cf0e4fa7ff2808c9aa13b605b29 (diff) | |
download | git-bug-afbda3cc23282b6c37849048d33f9c9c12ef8fb8.tar.gz |
git hook script exmaple to prefill commit message from selected issue
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/git_hooks/prepare-commit-msg | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/misc/git_hooks/prepare-commit-msg b/misc/git_hooks/prepare-commit-msg new file mode 100755 index 00000000..e1d38c3c --- /dev/null +++ b/misc/git_hooks/prepare-commit-msg @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Insert selected git-bug issue identifier in the comment. +# if no selected issue, print in comments the list of open issues. +# +cmtChar=`git config --get core.commentchar` +hashChar="#" +if [ "$cmtChar" = "" ] +then + cmtChar="#" +fi +if [ "$cmtChar" = "#" ] +then + hashChar=":" +fi + +ISSUE=`git bug show --fields shortId` +if [ "$ISSUE" = "" ] +then + echo "$cmtChar !!!!! insert $hashChar<issue_id> in your comment, pick one in list below." >> "$1" + git bug ls status:open |sed 's/ open\t/ /'| sed "s/^/$cmtChar/" >> "$1" +else + sed -i "1i$hashChar$ISSUE " "$1" +fi |