Skip to content

Commit b67185d

Browse files
Kirill Smelkovnavytux
authored andcommitted
Git/WinGit: Add default textconv for .doc & .pdf
XXX at present bin/astextplain output encoding is hardcoded to UTF-8. Even in such a state the service provided is more than useful, so let's please merge the patch. Signed-off-by: Kirill Smelkov <[email protected]>
1 parent c1aa801 commit b67185d

4 files changed

Lines changed: 33 additions & 1 deletion

File tree

bin/astextplain

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh -e
2+
# minimalistic replacement for `run-mailcap --action=cat <file>`
3+
4+
if test "$#" != 1 ; then
5+
echo "Usage: astextplain <file>" 1>&2
6+
exit 1
7+
fi
8+
9+
# XXX output encoding (UTF-8) hardcoded
10+
case "$1" in
11+
*.doc | *.DOC)
12+
antiword -m UTF-8 "$1"
13+
;;
14+
*.pdf | *.PDF)
15+
pdftotext -layout "$1" -enc UTF-8 -
16+
;;
17+
*)
18+
echo "E: unsupported filetype $1" 1>&2
19+
exit 1
20+
;;
21+
esac
22+
23+
exit 0

etc/gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.doc diff=astextplain
2+
*.DOC diff=astextplain
3+
*.pdf diff=astextplain
4+
*.PDF diff=astextplain

etc/gitconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
sslCAinfo = /mingw/bin/curl-ca-bundle.crt
1212
[sendemail]
1313
smtpserver = /mingw/bin/msmtp.exe
14+
15+
[diff "astextplain"]
16+
textconv = astextplain

share/WinGit/copy-files.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ echo "Copying files" &&
3636
git --git-dir=/doc/git/html/.git archive HEAD | tar xf -) &&
3737
(cd / && tar cf - \
3838
$(ls {bin,libexec/git-core}/git* | grep -v 'cvs\|shell\|archimport\|instaweb') \
39-
bin/{antiword.exe,awk,basename.exe,bash.exe,bison.exe,yacc,bunzip2,bzip2.exe,c_rehash,\
39+
bin/{antiword.exe,astextplain,awk,basename.exe,bash.exe,bison.exe,yacc,\
40+
bunzip2,bzip2.exe,c_rehash,\
4041
cat.exe,chmod.exe,clear,cmp.exe,cp.exe,cut.exe,cvs.exe,date.exe,diff.exe,\
4142
dirname.exe,\
4243
du.exe,echo,egrep,env.exe,expr.exe,false.exe,find.exe,flex.exe,gawk.exe,grep.exe,\
@@ -84,6 +85,7 @@ cp /git/contrib/completion/git-completion.bash etc/ &&
8485
cp /etc/termcap etc/ &&
8586
cp /etc/inputrc etc/ &&
8687
sed 's/ = \/mingw\// = \//' < /etc/gitconfig > etc/gitconfig &&
88+
cp /etc/gitattributes etc/ &&
8789
cp /share/WinGit/Git\ Bash.vbs . &&
8890
mkdir git-cheetah &&
8991
cp /src/git-cheetah/explorer/git_shell_ext.dll git-cheetah/ &&

0 commit comments

Comments
 (0)