Skip to content

Commit 79d2d51

Browse files
committed
improve reporting bugs
Closes #121
1 parent 3aa7158 commit 79d2d51

File tree

2 files changed

+73
-2
lines changed

2 files changed

+73
-2
lines changed

readme.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,24 @@ Pull requests quite welcome, along with any feedback or ideas.
9292

9393
### Reporting bugs
9494

95-
Providing the original diff text inline in the issue is quite helpful.
95+
If you find a bug using the following command
9696

9797
```sh
98-
git --no-pager diff > output.diff
98+
git diff HEAD..HEAD^
9999
```
100100

101+
You can use [report-bug.sh](./report-bug.sh) we provide
102+
103+
```sh
104+
./report-bug.sh 'git diff HEAD..HEAD^'
105+
106+
# or
107+
108+
curl https://raw.githubusercontent.com/so-fancy/diff-so-fancy/master/report-bug.sh | bash -s 'git diff HEAD..HEAD^' 'diff.txt'
109+
```
110+
111+
Grab the output file and attach to the GitHub issue you create. A base64 version is also copied to your clipboard so you can paste to the issue.
112+
101113
### Hacking
102114

103115
```sh

report-bug.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
clipboard() {
4+
local copy_cmd
5+
if [ -n "$PBCOPY_SERVER" ]; then
6+
local body="" buffer
7+
body=$(cat)
8+
# while IFS= read -r buffer; do
9+
# body="$body$buffer\n";
10+
# done
11+
curl $PBCOPY_SERVER --data-urlencode body="$body" >/dev/null 2>&1
12+
return $?
13+
fi
14+
if type putclip >/dev/null 2>&1; then
15+
copy_cmd="putclip"
16+
elif [ -e /dev/clipboard ];then
17+
cat > /dev/clipboard
18+
return 0
19+
elif type clip >/dev/null 2>&1; then
20+
if [[ $LANG = UTF-8 ]]; then
21+
copy_cmd="iconv -f utf-8 -t shift_jis | clip"
22+
else
23+
copy_cmd=clip
24+
fi
25+
# copy_cmd=clip
26+
elif which pbcopy >/dev/null 2>&1; then
27+
copy_cmd="pbcopy"
28+
elif which xclip >/dev/null 2>&1; then
29+
# copy_cmd="xclip -i -selection clipboard"
30+
copy_cmd="xclip"
31+
elif which xsel >/dev/null 2>&1 ; then
32+
local copy_cmd="xsel -b"
33+
fi
34+
if [ -n "$copy_cmd" ] ;then
35+
eval $copy_cmd
36+
else
37+
echo "clipboard is unavailable" 1>&2
38+
fi
39+
}
40+
41+
file=${2:-diff.txt}
42+
43+
echo $1 > $file
44+
eval $1 >> $file
45+
46+
echo "
47+
48+
" >> $file
49+
50+
echo "$1 --color" >> $file
51+
eval "$1 --color" >> $file
52+
53+
echo "git config pager.diff" >> $file
54+
eval "git config pager.diff" >> $file
55+
56+
echo "git config pager.show" >> $file
57+
eval "git config pager.show" >> $file
58+
59+
cat $file | base64 | clipboard

0 commit comments

Comments
 (0)