ソースを参照

Pass correct type to config methods.

Jelmer Vernooij 7 年 前
コミット
3365e03be1
3 ファイル変更9 行追加3 行削除
  1. 6 0
      dulwich/config.py
  2. 1 1
      dulwich/ignore.py
  3. 2 2
      dulwich/repo.py

+ 6 - 0
dulwich/config.py

@@ -437,6 +437,12 @@ class StackedConfig(Config):
         return backends
 
     def get(self, section, name):
+        if not isinstance(section, tuple):
+            section = (section, )
+        if not all([isinstance(subsection, bytes) for subsection in section]):
+            raise TypeError(section)
+        if not isinstance(name, bytes):
+            raise TypeError(name)
         for backend in self.backends:
             try:
                 return backend.get(section, name)

+ 1 - 1
dulwich/ignore.py

@@ -257,7 +257,7 @@ def default_user_ignore_filter_path(config):
     :return: Path to a global ignore file
     """
     try:
-        return config.get(('core', ), 'excludesFile')
+        return config.get((b'core', ), b'excludesFile')
     except KeyError:
         pass
 

+ 2 - 2
dulwich/repo.py

@@ -939,8 +939,8 @@ class Repo(BaseRepo):
             tree = self[b'HEAD'].tree
         config = self.get_config()
         honor_filemode = config.get_boolean(
-            'core', 'filemode', os.name != "nt")
-        if config.get_boolean('core', 'core.protectNTFS', os.name == "nt"):
+            b'core', b'filemode', os.name != "nt")
+        if config.get_boolean(b'core', b'core.protectNTFS', os.name == "nt"):
             validate_path_element = validate_path_element_ntfs
         else:
             validate_path_element = validate_path_element_default