mirror of
https://github.com/tiennm99/serena.git
synced 2026-08-01 18:23:06 +00:00
Fix gitignore anchored pattern logic and update test
- Use correct anchoring logic: only patterns starting with '/' are anchored - Fix test expectation for negation patterns to match Git behavior - Apply code formatting
This commit is contained in:
@@ -205,9 +205,6 @@ class GitignoreParser:
|
||||
if is_anchored:
|
||||
line = line[1:]
|
||||
|
||||
# Remove directory marker at the end since we do not support directory-only patterns
|
||||
line = line.removesuffix("/")
|
||||
|
||||
# Adjust pattern based on gitignore file location
|
||||
if rel_dir:
|
||||
if is_anchored:
|
||||
|
||||
@@ -369,7 +369,7 @@ debug.log
|
||||
|
||||
assert "*.log" in patterns
|
||||
assert "!important.log" in patterns
|
||||
assert "!/src/keep.log" in patterns
|
||||
assert "!src/keep.log" in patterns
|
||||
|
||||
def test_comments_and_empty_lines(self):
|
||||
"""Test that comments and empty lines are ignored."""
|
||||
|
||||
Reference in New Issue
Block a user