1 #!/bin/sh 2 # 3 # Convert one or more git patches that have had it's CR:s stripped out by SMTP 4 # into something th 5 6 if [ $# -lt 1 ]; then 7 echo "usage: `basename $0` <filename>" >&2 8 exit 1 9 fi 10 11 convert_file() 12 { 13 sed -i "s/$/\r/g" "$1" 14 sed -i "s:^\(---\|+++ \)\(.*\)\r$:\1\2:g" "$1" 15 } 16 17 while [ $# -gt 0 ]; do 18 convert_file "$1" 19 shift 20 done 21