Flatten out all ${dir}/trunk

for f in *
do
    ls -d ${f}/trunk && (
       && git mv $f _$f && \
       && git mv _${f}/trunk $f && \
       && rm -r _$f \
       || break
   );
done
Make identical with ejabberd-contrib 2.1.x

rm -r *
git checkout upstream/2.1.x .
git add . --all
Fix to work with ejabberd master
Add ebin/ dirs with .keepme file to ensure Git tracks them