mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Improve Git repository creation.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user