Prechádzať zdrojové kódy

Skip lines with spaces only in .gitignore

fix #878
Andrey Torsunov 3 rokov pred
rodič
commit
00b511015d
2 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 1 1
      dulwich/ignore.py
  2. 1 1
      dulwich/tests/test_ignore.py

+ 1 - 1
dulwich/ignore.py

@@ -123,7 +123,7 @@ def read_ignore_patterns(f: BinaryIO) -> Iterable[bytes]:
         line = line.rstrip(b"\r\n")
 
         # Ignore blank lines, they're used for readability.
-        if not line:
+        if not line.strip():
             continue
 
         if line.startswith(b"#"):

+ 1 - 1
dulwich/tests/test_ignore.py

@@ -105,7 +105,7 @@ class ReadIgnorePatterns(TestCase):
         f = BytesIO(
             b"""
 # a comment
-
+\x20\x20
 # and an empty line:
 
 \\#not a comment