From: James Moger Date: Tue, 27 Dec 2011 22:31:03 +0000 (-0500) Subject: fixed renaming a repository into a new subfolder failed (issue 33) X-Git-Tag: v0.8.0~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c1a4cc7028954084019a7863085fa5d01aeafa9a;p=gitblit.git fixed renaming a repository into a new subfolder failed (issue 33) --- diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index ae2821da..e03089f4 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -29,6 +29,7 @@ The original `users.properties` file and it's corresponding implementation are * - added: filters menu to repositories page and activity page. You can filter by federation set, team, and simple custom regular expressions (issue 27) **New:** *web.customFilters=* - fixed: several a bugs in FileUserService related to cleaning up old repository permissions on a rename or delete +- fixed: renaming a repository into a new subfolder failed (issue 33) - added: optional flash-based 1-step *copy to clipboard* of the primary repository url - added: javascript-based 3-step (click, ctrl+c, enter) *copy to clipboard* of the primary repository url **New:** *web.allowFlashCopyToClipboard = true* diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index a62d4e40..a4680606 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -905,6 +905,11 @@ public class GitBlit implements ServletContextListener { .format("Can not rename repository ''{0}'' to ''{1}'' because ''{1}'' already exists.", repositoryName, repository.name)); } + File parentFile = destFolder.getParentFile(); + if (!parentFile.exists() && !parentFile.mkdirs()) { + throw new GitBlitException(MessageFormat.format( + "Failed to create folder ''{0}''", parentFile.getAbsolutePath())); + } if (!folder.renameTo(destFolder)) { throw new GitBlitException(MessageFormat.format( "Failed to rename repository ''{0}'' to ''{1}''.", repositoryName,