Skip to content

Instantly share code, notes, and snippets.

@ropery
Created October 14, 2011 04:46
Show Gist options
  • Save ropery/1286273 to your computer and use it in GitHub Desktop.
Save ropery/1286273 to your computer and use it in GitHub Desktop.
#!/bin/bash
name=iat
page=$(curl -s "http://git.berlios.de/cgi-bin/gitweb.cgi?p=${name};a=log")
commits=($(grep -Eo '<a href="[^"]+">commit</a> \| <a href="[^"]+">commitdiff</a> \| <a href="[^"]+">tree</a>' <<< "$page" | grep -Eo ';h=[a-z0-9]+' | cut -d= -f2- | uniq))
n=${#commits[@]}
for (( i=0; i<n; i++ )); do
h=${commits[i]}
printf 'Downloading commit: %s\n' "$h" >&2
curl "http://git.berlios.de/cgi-bin/gitweb.cgi?p=iat;a=patch;h=${h}" -s -o "$name-$( printf "%0${#n}d" $(( n - i )) )-$h.patch"
done
# git init
# git am *.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment