]> source.dussan.org Git - gitblit.git/commitdiff
Confirmed fix for GO settings manipulation (issue 85)
authorJames Moger <james.moger@gitblit.com>
Sat, 4 Aug 2012 00:39:50 +0000 (20:39 -0400)
committerJames Moger <james.moger@gitblit.com>
Sat, 4 Aug 2012 00:39:50 +0000 (20:39 -0400)
docs/04_releases.mkd
src/com/gitblit/FileSettings.java

index 335507fb1e19c94d4bb830876b9a9d5c6ba43bbe..b2a373c94abfa6056f9e2a45b0d6e49cb79f236c 100644 (file)
@@ -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)\r
 - Fixed Lucene charset encoding bug when reindexing a repository (issue 112)\r
 - Fixed null pointer in LdapUserSerivce if account has a null email address (issue 110)\r
+- Really fixed failure to update a GO setting from the manager (issue 85)\r
 \r
 #### additions\r
 \r
index 666bda05f53ef887f6ecdfe87e0625f07517cc72..be1f44f2c5f486111957cd52ccbc83b94a993b87 100644 (file)
@@ -87,8 +87,14 @@ public class FileSettings extends IStoredSettings {
                String content = FileUtils.readContent(propertiesFile, "\n");\r
                for (Map.Entry<String, String> setting:settings.entrySet()) {\r
                        String regex = "(?m)^(" + regExEscape(setting.getKey()) + "\\s*+=\\s*+)"\r
-                                   + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";                        \r
+                                   + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";\r
+                       String oldContent = content;\r
                        content = content.replaceAll(regex, setting.getKey() + " = " + setting.getValue());\r
+                       if (content.equals(oldContent)) {\r
+                               // did not replace value because it does not exist in the file\r
+                               // append new setting to content (issue-85)\r
+                               content += "\n" + setting.getKey() + " = " + setting.getValue();\r
+                       }\r
                }\r
                FileUtils.writeContent(propertiesFile, content);\r
                // manually set the forceReload flag because not all JVMs support real\r