ref: ae153891bc9365a47b3c74cd314dd12762e96aae
dir: /git2news/
#!/bin/rc
rfork en
fn fatal{
echo $* >[1=2]
exit $"*
}
fn printlog{
br=$1
mkdir -p $dir/$br
hash=`{cat /mnt/git/branch/heads/$br/hash}
while(~ $#hash 1){
echo $hash
msg=`{cat /mnt/git/object/$hash/msg}
author=`{cat /mnt/git/object/$hash/author}
parent=`{cat /mnt/git/object/$hash/parent}
date=`{mtime /mnt/git/object/$hash/msg | awk '{print $1}'}
cdate=`{date $date}
>$dir/$br/$hash {
echo 'author: ' $author
echo 'parent: ' $parent
echo 'date: ' $cdate
echo 'msg: ' $msg
}
touch -t $date $dir/$br/$hash
hash=$parent
}
}
test -r /mnt/git/ctl || fatal no gitfs running
dir=/lib/news
~ $#1 0 || dir=$1
branches=`{ls -p /mnt/git/branch/heads}
~ $#branches 0 && fatal no branches found
for(branch in $branches) printlog $branch