Improve Git repository creation.

This commit is contained in:
takezoe
2013-07-11 19:47:48 +09:00
parent d59e358caa
commit 81fe467b20
3 changed files with 27 additions and 15 deletions

View File

@@ -502,4 +502,20 @@ object JGitUtil {
}
}
def initRepository(dir: java.io.File): Unit = {
val repository = new RepositoryBuilder().setGitDir(dir).setBare.build
try {
repository.create
setReceivePack(repository)
} finally {
repository.close
}
}
private def setReceivePack(repository: org.eclipse.jgit.lib.Repository): Unit = {
val config = repository.getConfig
config.setBoolean("http", null, "receivepack", true)
config.save
}
}