blob: 7382a29e4f49a4442f6766bf08333831f2c5b2cc (
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
if [ -z $1 ]; then
CMD="git diff-index --raw --name-status HEAD"
else
CMD="git diff --raw --name-status $1^ $1"
fi
echo_exit()
{
echo $1
exit
}
find_files()
{
$CMD | grep '^\(A\|M\).*png$' | sed 's/^.\t//'
}
cd "$(git rev-parse --show-toplevel)"
[ $(find_files | wc -l) != 0 ] \
|| echo_exit "No changed .png files -- please 'git add' them first."
find_files | xargs -d "\n" optipng -o4 -i0 -fix
find_files | xargs -d "\n" advpng -z4
|