#! /bin/sh
( . /sw/bin/init.sh
  cd $HOME/projects/kanbun/mecab-kanbun
  git pull
  D=incoming/$USER/hakubun
  mkdir -p $D
  git add $D
  git commit -am sync
  git push origin master
  for F
  do B=`basename $F`
     case $B in
     *.utf-8) : ;;
     *) continue ;;
     esac
     if [ ! -s $D/$B ]
     then cp `ls -1t incoming/*/[th]*/$B | head -1` $D/$B
     fi
     open -t $D/$B
     ( sleep 10800
       git pull
       git add $D/$B
       git commit -am $D/$B
       git push origin master
     ) &
  done
) > $HOME/hakubun.log 2>&1
exit 0
