Skip to content

Conversation

yuya-takeyama
Copy link
Owner

Summary

  • Replace doublestar with Python fnmatch for AWS S3 sync compatibility
  • * now matches path separators, matching AWS CLI behavior
  • Add proper PSF-2.0 license attribution for ported code

Details

Problem

The current exclude pattern implementation using doublestar follows standard Unix glob behavior where * does not match path separators. This differs from AWS S3 sync which uses Python fnmatch where * matches everything including /.

For example:

  • Before (doublestar): --exclude "_next/*" only excludes _next/file.txt
  • After (fnmatch): --exclude "_next/*" excludes _next/file.txt, _next/subdir/file.txt, etc.

Solution

Ported Python fnmatch module to Go, maintaining the exact pattern matching behavior for AWS S3 sync compatibility.

Changes

  1. New fnmatch package: Go port of Python fnmatch with proper PSF-2.0 license attribution
  2. Pattern matching update: Replace doublestar.Match with fnmatch.Match
  3. Test updates: Verify AWS S3 sync compatible behavior
  4. License compliance: Add LICENSE-PSF and NOTICE files with proper attribution

Breaking Change

⚠️ This changes exclude pattern behavior to match AWS S3 sync. Patterns with * now match across directory boundaries.

Test plan

  • Unit tests for fnmatch package
  • Integration tests for exclude patterns
  • Verify AWS S3 sync compatibility
  • Manual testing with real S3 buckets

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

yuya-takeyama and others added 4 commits August 11, 2025 03:25
- Port Python fnmatch module to Go for AWS S3 sync compatibility
- Implement full Unix shell wildcard pattern matching
- * matches everything including path separators (Python behavior)
- Add comprehensive tests and benchmarks
- Include proper PSF-2.0 license attribution

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace doublestar with fnmatch for pattern matching
- * now matches path separators (AWS S3 sync behavior)
- Update tests to verify AWS S3 sync compatibility
- Remove doublestar dependency

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
- Add LICENSE-PSF file with full PSF-2.0 license text
- Add NOTICE file documenting changes from original Python code
- Update main LICENSE file to reference PSF-2.0 for fnmatch code
- Update README with license information
- Update fnmatch.go header with proper copyright attribution

Co-Authored-By: Claude <noreply@anthropic.com>
@yuya-takeyama yuya-takeyama marked this pull request as ready for review August 10, 2025 18:35
@yuya-takeyama yuya-takeyama merged commit 9c6f81d into main Aug 10, 2025
1 check passed
@yuya-takeyama yuya-takeyama deleted the yuya-takeyama/feat/aws-s3-sync-compatible-exclude branch August 10, 2025 18:35
@yuya-takeyama-tagpr yuya-takeyama-tagpr bot mentioned this pull request Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant