init-db: move writing repo version into a function