Commit Diff


commit - 3556e52bb65c98e478ed3ff184bbcddedbbe2231
commit + 53d3dfeb852028f28da934577a1ea9429125c8ac
blob - d87c93382b8d392870534e8be78d2f3dcc2eecbe
blob + b564a0e4c5f28780c71a4c5bca42fcaa0d3ec946
--- dulwich/repo.py
+++ dulwich/repo.py
@@ -1191,7 +1191,7 @@ class Repo(BaseRepo):
             raise UnsupportedVersion(format_version)
 
         for extension, _value in config.items((b"extensions",)):
-            if extension not in (b"worktreeconfig",):
+            if extension.lower() not in (b"worktreeconfig",):
                 raise UnsupportedExtension(extension)
 
         if object_store is None:
blob - a063c45760ce8294805392e458913e61f34800cf
blob + 1eeea3cc3065bd91985ccc024ec0e2495b1d1f88
--- tests/test_repository.py
+++ tests/test_repository.py
@@ -1141,6 +1141,22 @@ class BuildRepoRootTests(TestCase):
         c.write_to_path()
         cs = r.get_config_stack()
         self.assertEqual(cs.get(("user",), "name"), b"Jelmer")
+
+    def test_worktreeconfig_extension_case(self):
+        """Test that worktree code does not error for alternate case format."""
+        r = self._repo
+        c = r.get_config()
+        c.set(("core",), "repositoryformatversion", "1")
+        # Capitalize "Config"
+        c.set(("extensions",), "worktreeConfig", True)
+        c.write_to_path()
+        c = r.get_worktree_config()
+        c.set(("user",), "repositoryformatversion", "1")
+        c.set((b"user",), b"name", b"Jelmer")
+        c.write_to_path()
+        # The following line errored before
+        # https://github.com/jelmer/dulwich/issues/1285 was addressed
+        Repo(self._repo_dir)
 
     def test_repositoryformatversion_1_extension(self):
         r = self._repo