diff options
author | James Moger <james.moger@gitblit.com> | 2013-08-21 10:35:46 -0700 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-08-21 10:35:46 -0700 |
commit | 75f2e6777f8fa134ad0a1ef35fa580ba104f162e (patch) | |
tree | f56aa33da47f5949dd73a99d08cf079b61109036 /src | |
parent | 005a65d1862ec1fe940b4ef2b5dd47dca82d3b28 (diff) | |
parent | acb5bdf953e4242c175b22b4ddd2197079ee6ace (diff) | |
download | gitblit-75f2e6777f8fa134ad0a1ef35fa580ba104f162e.tar.gz gitblit-75f2e6777f8fa134ad0a1ef35fa580ba104f162e.zip |
Merge pull request #114 from fzs/description
Maintain repository 'description' file.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/gitblit/GitBlit.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index cb5c0c5f..6ea348d5 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -1985,6 +1985,14 @@ public class GitBlit implements ServletContextListener { boolean hasOrigin = !StringUtils.isEmpty(config.getString("remote", "origin", "url")); if (config != null) { + // Initialize description from description file + if (getConfig(config,"description", null) == null) { + File descFile = new File(r.getDirectory(), "description"); + if (descFile.exists()) { + config.setString(Constants.CONFIG_GITBLIT, null, "description", + com.gitblit.utils.FileUtils.readContent(descFile, System.getProperty("line.separator"))); + } + } model.description = getConfig(config, "description", ""); model.originRepository = getConfig(config, "originRepository", null); model.addOwners(ArrayUtils.fromString(getConfig(config, "owner", ""))); @@ -2497,6 +2505,15 @@ public class GitBlit implements ServletContextListener { // update settings if (r != null) { updateConfiguration(r, repository); + // Update the description file + File descFile = new File(r.getDirectory(), "description"); + if (repository.description != null) + { + com.gitblit.utils.FileUtils.writeContent(descFile, repository.description); + } + else if (descFile.exists() && !descFile.isDirectory()) { + descFile.delete(); + } // only update symbolic head if it changes String currentRef = JGitUtils.getHEADRef(r); if (!StringUtils.isEmpty(repository.HEAD) && !repository.HEAD.equals(currentRef)) { |