On Fri, Jun 05, 2009 at 09:05:50AM +0200, Sylvain Beucler wrote: > On Fri, Jun 05, 2009 at 01:21:26AM +0300, Sergey Poznyakoff wrote: > > Sylvain Beucler <b...@gnu.org> ha escrit: > > > > > Do you think you could improve the script so it can compare 2 > > > hierarchies (e.g. /srv/git/*/* and > > > /srv/git/backup/backup-20090527/*/*) and get the ones who are more > > > recent in the backup? > > > > Sure, I can. So, the script shall select the most recent repo and copy > > it to /srv/whatever at once, right? > > I think it's better that the script stays 'read-only' and outputs the > name of the repositories to replace. We can shutdown the service for 2 > minutes.
Based on reading your code I'm running the following, should be good: for i in *.git */*.git; do ts1=$(GIT_DIR=$i git rev-list --max-count=1 --timestamp --all 2>/dev/null | awk '{print $1}'); ts2=$(GIT_DIR=backup/backup-20090527/$i git rev-list --max-count=1 --timestamp --all 2>/dev/null | awk '{print $1}'); ts1=${ts1:-0}; ts2=${ts2:-0}; if [ "$ts2" -gt "$ts1" ]; then echo $i $ts1 $ts2; fi; done Just need to exclude cvs2git repos. -- Sylvain