aboutsummaryrefslogtreecommitdiffstats
path: root/misc/git_hooks/prepare-commit-msg
blob: e1d38c3c047b267b599a216e791b217673532318 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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