Skip to content

docs: clarify directory-pattern semantics and update tests #122

@RyanL2004

Description

@RyanL2004

While working on enhancing the test coverage for directory pattern matching in GitIngest, I encountered discrepancies between the assumptions in the TODO comments and the actual behavior of the pattern matching. Specifically, patterns like src/*, /src/*, and src/ do not behave as expected. Below is a summary of the observations and suggested updates for clarity and next steps.


Key Findings

1. Pattern Mismatches

  • src/*: Matches all files recursively under src/, instead of just direct children.
  • /src/*: Does not match any files. Leading slashes are not supported.
  • src/: Does not match recursively. Correct pattern for recursive matching is src/**.

2. Cross-Platform Path Separator Issues

  • Problem: Path separators were inconsistent across Windows and Unix systems, causing failures in test comparisons.
  • Solution: Implemented path normalization using Path() to ensure compatibility.

3. Improved Tests

  • test_include_src_star_pattern: Correctly verifies that src/* matches all files recursively under src/.
  • test_include_src_recursive: Uses src/** for explicit recursive matching.
  • Path normalization fixes ensure the tests work across different platforms.

4. Test Documentation & Structure

  • Added descriptive docstrings and improved error messages.
  • Utilized set comparisons for more reliable and readable file path verification.
  • Comments added to clarify test expectations and behavior.

Conclusion

  • Through this testing process, I discovered several differences between the expected and actual behavior of the pattern matching system.
  • I proceeded with updating the test cases to reflect the real functionality, so it would help clarify the intended behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionCommunity talk on a given topicstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions