apply-from-gmane: accept permalinks, too
[msysgit.git] / bin / apply-from-gmane.sh
blob0b337f2f013cc9f97450d09a8cec683863a21632
1 #!/bin/sh
3 URL="$1"
5 case "$URL" in
6 http://mid.gmane.org*)
7 TMP=.git/apply.tmp
8 curl -D $TMP "$URL" > /dev/null
9 URL=$(sed -n 's/^Location: //p' < $TMP | tr -d '\r\n');;
10 http://thread.*) URL=http://article.${URL#http://thread.};;
11 http://permalink.gmane.org*) URL=http://article.${URL#http://permalink.};;
12 http://*|article.gmane.org*) ;;
13 *@*)
14 TMP=.git/apply.tmp
15 curl -D $TMP http://mid.gmane.org/$1 > /dev/null
16 URL=$(sed -n 's/^Location: //p' < $TMP | tr -d '\r\n');;
17 *) URL=http://article.gmane.org/gmane.comp.version-control.msysgit/$1;;
18 esac
20 case "$URL" in
21 */raw) ;;
22 *) URL=${URL%/}/raw;;
23 esac
25 curl $URL | git am --whitespace=fix -s