瀏覽代碼

ignore: question mark should not match slash

pared 6 年之前
父節點
當前提交
5219d79334
共有 2 個文件被更改,包括 2 次插入1 次删除
  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'*':
             res += b'[^/]*'
         elif c == b'?':
-            res += b'.'
+            res += b'[^/]'
         elif c == b'[':
             j = i
             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/bar/", b"/bar/"),
     (b"foo/bar/", b"foo/bar/*"),
+    (b"foo/bar", b"foo?bar")
 ]