1
0
Fork 0

- escape '+' in awk pattern (gawk doesn't need it, but mawk does)

- change the mktemp lines to please Debian's stoneage version ... sigh
- reject archives
This commit is contained in:
mfranz 2007-03-08 23:16:57 +00:00
parent cbae8f95ac
commit 3f1b379e9a

View file

@ -37,14 +37,14 @@
# $1 and $2 are guaranteed not to contain spaces, only $1 is guaranteed # $1 and $2 are guaranteed not to contain spaces, only $1 is guaranteed
# to actually exist. Such as script can be used to upload the file to an # to actually exist. Such as script can be used to upload the file to an
# ftp-/webserver, and/or to remove one or both files. Example using # ftp-/webserver, and/or to remove one or both files. Example using
# KDE's kfmclient for upload (alternatives: ncftpput, gnomevfs-copy, ...): # KDE's kfmclient for upload (alternatives: ncftpput, gnomevfs-copy, wput):
# #
# $ cat ~/bin/fg-upload # $ cat ~/bin/fg-upload
# #!/bin/bash # #!/bin/bash
# echo "uploading $1" # echo "uploading $1"
# if kfmclient copy $1 ftp://user:password@server.com; then # if kfmclient copy $1 ftp://user:password@server.com; then
# echo "deleting $1 $2" # echo "deleting $1 $2"
# rm -rf $1 $2 # rm -f $1 $2
# #
# echo "Done. URL: ftp://server.com/$1" # echo "Done. URL: ftp://server.com/$1"
# else # else
@ -97,7 +97,7 @@ function diffstat {
/^Index: / { dofile(); scan = bin = 0; file = $2; n++; next } /^Index: / { dofile(); scan = bin = 0; file = $2; n++; next }
/^@@/ { scan = 1; next } /^@@/ { scan = 1; next }
/^Binary/ { if (!scan) bin = 1; next } /^Binary/ { if (!scan) bin = 1; next }
/^+/ { if (scan) a++; next } /^\+/ { if (scan) a++; next }
/^-/ { if (scan) r++; next } /^-/ { if (scan) r++; next }
/^!/ { if (scan) c++; next } /^!/ { if (scan) c++; next }
END { END {
@ -109,14 +109,14 @@ function diffstat {
} }
# create temporary dir that's automatcally removed on exit # create temporary dir that's automatically removed on exit
TMP=$(mktemp -d -t $SELF.$BASE.XXX) || (echo "$0: can't create temporary dir"; exit 1) TMP=$(mktemp -d /tmp/$SELF.$BASE.XXXXXX) || (echo "$0: can't create temporary dir"; exit 1)
trap "rm -rf $TMP" 0 1 2 3 13 15 trap "rm -rf $TMP" 0 1 2 3 13 15
# move old files out of the way # move old files out of the way
for i in $DIFF $CDIFF $ARCHIVE; do for i in $DIFF $CDIFF $ARCHIVE; do
[ -f $i ] && mv $i $(mktemp $i.X) [ -f $i ] && mv $i $(mktemp $i.XXXXXX)
done done
@ -177,6 +177,9 @@ if [ -f $TMP/check ]; then
CVS/*|*/CVS/*) CVS/*|*/CVS/*)
REJECT "$i\t\t(CVS file)" REJECT "$i\t\t(CVS file)"
;; ;;
*.tar.gz*|*.tar.bz2*|*.tgz|*.zip)
REJECT "$i\t\t(archive)"
;;
*.blend|*.blend[0-9]|*.blend[0-9][0-9]) *.blend|*.blend[0-9]|*.blend[0-9][0-9])
REJECT "$i\t\t(blender file)" REJECT "$i\t\t(blender file)"
;; ;;