mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 02:56:08 +01:00
use FileUtil.withTmpDir and FileUtil.using
This commit is contained in:
@@ -9,7 +9,6 @@ import org.eclipse.jgit.api.Git
|
||||
import org.apache.commons.io._
|
||||
import jp.sf.amateras.scalatra.forms._
|
||||
import org.eclipse.jgit.lib.PersonIdent
|
||||
import scala.Some
|
||||
|
||||
class CreateRepositoryController extends CreateRepositoryControllerBase
|
||||
with RepositoryService with AccountService with WikiService with LabelsService with ActivityService
|
||||
@@ -74,8 +73,7 @@ trait CreateRepositoryControllerBase extends ControllerBase {
|
||||
JGitUtil.initRepository(gitdir)
|
||||
|
||||
if(form.createReadme){
|
||||
val tmpdir = getInitRepositoryDir(form.owner, form.name)
|
||||
try {
|
||||
FileUtil.withTmpDir(getInitRepositoryDir(form.owner, form.name)){ tmpdir =>
|
||||
// Clone the repository
|
||||
Git.cloneRepository.setURI(gitdir.toURI.toString).setDirectory(tmpdir).call
|
||||
|
||||
@@ -97,9 +95,6 @@ trait CreateRepositoryControllerBase extends ControllerBase {
|
||||
.setCommitter(new PersonIdent(loginUserName, loginAccount.mailAddress))
|
||||
.setMessage("Initial commit").call
|
||||
git.push.call
|
||||
|
||||
} finally {
|
||||
FileUtils.deleteDirectory(tmpdir)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user