Fixed syntax of permissions for chmod
handle case where $main_repo already exists but is no git repo

(there’s still two things: mktemp -d might fail, in which case
we regress to the previous behaviour, and after the check the
$main_repo can come to exist before the mv, with the same outcome,
but since we do check the return value of the mv…)
Merge branch 'Branch_5_1' of git+ssh://scm.fusionforge.org//var/lib/gforge/chroot/scmrepos/git/fusionforge/fusionforge into Branch_5_1
I think is_file("$main_repo/HEAD") gives a warning if !is_dir($main_repo)