diff options
author | James Moger <james.moger@gitblit.com> | 2012-08-03 20:39:50 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-08-03 20:39:50 -0400 |
commit | f3ff376a5eb945f15329b66bbb7d69ed3ca2ce3f (patch) | |
tree | 52c67f3b8e56f53d7166b7fe618cd99905d1e894 | |
parent | 5efc4a2f4a3b6c029c0f22f485393669a735d805 (diff) | |
download | gitblit-f3ff376a5eb945f15329b66bbb7d69ed3ca2ce3f.tar.gz gitblit-f3ff376a5eb945f15329b66bbb7d69ed3ca2ce3f.zip |
Confirmed fix for GO settings manipulation (issue 85)
-rw-r--r-- | docs/04_releases.mkd | 1 | ||||
-rw-r--r-- | src/com/gitblit/FileSettings.java | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index 335507fb..b2a373c9 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -16,6 +16,7 @@ If you are updating from an earlier release AND you have indexed branches with t - Output real RAW content, not simulated RAW content (issue 114)
- Fixed Lucene charset encoding bug when reindexing a repository (issue 112)
- Fixed null pointer in LdapUserSerivce if account has a null email address (issue 110)
+- Really fixed failure to update a GO setting from the manager (issue 85)
#### additions
diff --git a/src/com/gitblit/FileSettings.java b/src/com/gitblit/FileSettings.java index 666bda05..be1f44f2 100644 --- a/src/com/gitblit/FileSettings.java +++ b/src/com/gitblit/FileSettings.java @@ -87,8 +87,14 @@ public class FileSettings extends IStoredSettings { String content = FileUtils.readContent(propertiesFile, "\n");
for (Map.Entry<String, String> setting:settings.entrySet()) {
String regex = "(?m)^(" + regExEscape(setting.getKey()) + "\\s*+=\\s*+)"
- + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
+ + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
+ String oldContent = content;
content = content.replaceAll(regex, setting.getKey() + " = " + setting.getValue());
+ if (content.equals(oldContent)) {
+ // did not replace value because it does not exist in the file
+ // append new setting to content (issue-85)
+ content += "\n" + setting.getKey() + " = " + setting.getValue();
+ }
}
FileUtils.writeContent(propertiesFile, content);
// manually set the forceReload flag because not all JVMs support real
|