Explorar o código

ignore: question mark should not match slash

pared %!s(int64=6) %!d(string=hai) anos
pai
achega
5219d79334
Modificáronse 2 ficheiros con 2 adicións e 1 borrados
  1. 1 1
      dulwich/ignore.py
  2. 1 0
      dulwich/tests/test_ignore.py

+ 1 - 1
dulwich/ignore.py

@@ -38,7 +38,7 @@ def _translate_segment(segment):
         if c == b'*':
         if c == b'*':
             res += b'[^/]*'
             res += b'[^/]*'
         elif c == b'?':
         elif c == b'?':
-            res += b'.'
+            res += b'[^/]'
         elif c == b'[':
         elif c == b'[':
             j = i
             j = i
             if j < n and segment[j:j+1] == b'!':
             if j < n and segment[j:j+1] == b'!':

+ 1 - 0
dulwich/tests/test_ignore.py

@@ -65,6 +65,7 @@ NEGATIVE_MATCH_TESTS = [
     (b"foo/foo.c", b"/*.c"),
     (b"foo/foo.c", b"/*.c"),
     (b"foo/bar/", b"/bar/"),
     (b"foo/bar/", b"/bar/"),
     (b"foo/bar/", b"foo/bar/*"),
     (b"foo/bar/", b"foo/bar/*"),
+    (b"foo/bar", b"foo?bar")
 ]
 ]