Compare commits

...

3 Commits

Author SHA1 Message Date
Naoki Takezoe
47ec2d4712 Copy only LFS dir and insert default priorities in forking repository 2017-07-05 00:21:15 +09:00
Naoki Takezoe
31160f42cb Release 4.14.1 2017-07-05 00:01:33 +09:00
Naoki Takezoe
4f11cbaa77 (refs #1631)Copy repository files directory only if it exists 2017-07-04 23:57:18 +09:00
5 changed files with 32 additions and 13 deletions

View File

@@ -71,11 +71,13 @@ Support
Release Notes Release Notes
------------- -------------
### 4.14 - 1 Jul 2017 ### 4.14.1 - 4 Jul 2017
- Bug fix: Possibility of error in forking repository
### 4.14 - 1 Jul 2017
- Support priority in issues and pull requests - Support priority in issues and pull requests
- Show icons when the sidebar is collapsed - Show icons when the sidebar is collapsed
- Support gollumn events in web hook - Support gollum events in web hook
- Support account (user / group) level web hook - Support account (user / group) level web hook
- Add `--max_file_size` option - Add `--max_file_size` option
- Configuration by system property or environment variable - Configuration by system property or environment variable

View File

@@ -1,6 +1,6 @@
val Organization = "io.github.gitbucket" val Organization = "io.github.gitbucket"
val Name = "gitbucket" val Name = "gitbucket"
val GitBucketVersion = "4.14.0" val GitBucketVersion = "4.14.1"
val ScalatraVersion = "2.5.0" val ScalatraVersion = "2.5.0"
val JettyVersion = "9.3.19.v20170502" val JettyVersion = "9.3.19.v20170502"

View File

@@ -38,5 +38,6 @@ object GitBucketCoreModule extends Module("gitbucket-core",
new Version("4.14.0", new Version("4.14.0",
new LiquibaseMigration("update/gitbucket-core_4.14.xml"), new LiquibaseMigration("update/gitbucket-core_4.14.xml"),
new SqlMigration("update/gitbucket-core_4.14.sql") new SqlMigration("update/gitbucket-core_4.14.sql")
) ),
new Version("4.14.1")
) )

View File

@@ -594,22 +594,23 @@ trait AccountControllerBase extends AccountManagementControllerBase {
// Insert default labels // Insert default labels
insertDefaultLabels(accountName, repository.name) insertDefaultLabels(accountName, repository.name)
// Insert default priorities
insertDefaultPriorities(accountName, repository.name)
// clone repository actually // clone repository actually
JGitUtil.cloneRepository( JGitUtil.cloneRepository(
getRepositoryDir(repository.owner, repository.name), getRepositoryDir(repository.owner, repository.name),
getRepositoryDir(accountName, repository.name)) FileUtil.deleteIfExists(getRepositoryDir(accountName, repository.name)))
// Create Wiki repository // Create Wiki repository
JGitUtil.cloneRepository( JGitUtil.cloneRepository(getWikiRepositoryDir(repository.owner, repository.name),
getWikiRepositoryDir(repository.owner, repository.name), FileUtil.deleteIfExists(getWikiRepositoryDir(accountName, repository.name)))
getWikiRepositoryDir(accountName, repository.name))
// Copy files // Copy LFS files
FileUtils.copyDirectory( val lfsDir = getLfsDir(repository.owner, repository.name)
Directory.getRepositoryFilesDir(repository.owner, repository.name), if(lfsDir.exists){
Directory.getRepositoryFilesDir(accountName, repository.name) FileUtils.copyDirectory(lfsDir, FileUtil.deleteIfExists(getLfsDir(accountName, repository.name)))
) }
// Record activity // Record activity
recordForkActivity(repository.owner, repository.name, loginUserName, accountName) recordForkActivity(repository.owner, repository.name, loginUserName, accountName)

View File

@@ -68,9 +68,24 @@ object FileUtil {
def readableSize(size: Long): String = FileUtils.byteCountToDisplaySize(size) def readableSize(size: Long): String = FileUtils.byteCountToDisplaySize(size)
/**
* Delete the given directory if it's empty.
* Do nothing if the given File is not a directory or not empty.
*/
def deleteDirectoryIfEmpty(dir: File): Unit = { def deleteDirectoryIfEmpty(dir: File): Unit = {
if(dir.isDirectory() && dir.list().isEmpty) { if(dir.isDirectory() && dir.list().isEmpty) {
FileUtils.deleteDirectory(dir) FileUtils.deleteDirectory(dir)
} }
} }
/**
* Delete file or directory forcibly.
*/
def deleteIfExists(file: java.io.File): java.io.File = {
if(file.exists){
FileUtils.forceDelete(file)
}
file
}
} }