2
0
Эх сурвалжийг харах

Add tests for default git config file.

Jelmer Vernooij 13 жил өмнө
parent
commit
3577f2d329

+ 1 - 1
NEWS

@@ -4,7 +4,7 @@
 
   * The config parser now supports the git-config file format as
     described in git-config(1) and can write git config files.
-    (Jelmer Vernooij, #531092)
+    (Jelmer Vernooij, #531092, #768687)
 
 0.8.2	2011-12-18
 

+ 2 - 2
dulwich/config.py

@@ -239,7 +239,7 @@ class ConfigFile(ConfigDict):
                         value = value[:-2]
                         continuation = True
                     else:
-                        continuation = True
+                        continuation = False
                     value = _parse_string(value)
                     ret._values[section][setting] = value
                     if not continuation:
@@ -249,7 +249,7 @@ class ConfigFile(ConfigDict):
                     line = line[:-2]
                     continuation = True
                 else:
-                    continuation = True
+                    continuation = False
                 value = _parse_string(line)
                 ret._values[section][setting] += value
                 if not continuation:

+ 13 - 0
dulwich/tests/test_config.py

@@ -44,6 +44,19 @@ class ConfigFileTests(TestCase):
     def test_eq(self):
         self.assertEquals(ConfigFile(), ConfigFile())
 
+    def test_default_config(self):
+        cf = self.from_file("""[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = false
+	logallrefupdates = true
+""")
+        self.assertEquals(ConfigFile({("core", ): {
+            "repositoryformatversion": "0",
+            "filemode": "true",
+            "bare": "false",
+            "logallrefupdates": "true"}}), cf)
+
     def test_from_file_empty(self):
         cf = self.from_file("")
         self.assertEquals(ConfigFile(), cf)