1#!/bin/sh
2#
3# Insert selected git-bug issue identifier in the comment.
4# if no selected issue, print in comments the list of open issues.
5#
6cmtChar=`git config --get core.commentchar`
7hashChar="#"
8if [ "$cmtChar" = "" ]
9then
10 cmtChar="#"
11fi
12if [ "$cmtChar" = "#" ]
13then
14 hashChar=":"
15fi
16
17ISSUE=`git bug show --fields shortId`
18if [ "$ISSUE" = "" ]
19then
20 echo "$cmtChar !!!!! insert $hashChar<issue_id> in your comment, pick one in list below." >> "$1"
21 git bug ls status:open |sed 's/ open\t/ /'| sed "s/^/$cmtChar/" >> "$1"
22else
23 sed -i "1i$hashChar$ISSUE " "$1"
24fi