Skip to content

fix: add .gitattributes to enforce LF line endings for shell scripts#8

Closed
curlysasha wants to merge 1 commit intomasterfrom
claude/issue-7-20260107-1059
Closed

fix: add .gitattributes to enforce LF line endings for shell scripts#8
curlysasha wants to merge 1 commit intomasterfrom
claude/issue-7-20260107-1059

Conversation

@curlysasha
Copy link
Owner

Summary

This PR fixes issue #7 where entrypoint.sh was not found on Windows 11 due to CRLF line endings.

Changes

  • Added .gitattributes file to enforce LF line endings for all shell scripts
  • Ensures cross-platform compatibility for Windows, macOS, and Linux

Testing

After merging, Windows users should:

  1. Pull latest changes
  2. Delete and re-clone the repository
  3. Rebuild Docker images: docker-compose build --no-cache
  4. Run: docker-compose up -d

Closes #7


Generated with Claude Code

This fixes issue #7 where entrypoint.sh was not found on Windows due to
CRLF line endings causing the shebang to fail.

The .gitattributes file ensures:
- All .sh files use LF line endings on all platforms
- Docker containers work correctly on Windows, macOS, and Linux

Co-authored-by: curlysasha <curlysasha@users.noreply.github.com>
@claude
Copy link

claude bot commented Jan 7, 2026

Code Review - PR #8: Fix .gitattributes for LF Line Endings

Summary

This PR addresses issue #7 by adding a .gitattributes file to enforce LF line endings for shell scripts across all platforms. This is a critical fix for Windows users experiencing Docker container startup failures.


✅ Strengths

  1. Correct Root Cause Analysis: The PR correctly identifies and fixes the CRLF/LF line ending issue that causes the shebang (#!/bin/sh) to fail on Windows-cloned repositories.

  2. Minimal and Focused: The change is minimal (5 lines) and doesn't introduce unnecessary complexity.

  3. Good Documentation: The PR description provides clear testing instructions for Windows users.

  4. Follows Best Practices: Using .gitattributes is the industry-standard solution for this type of cross-platform line ending issue.


📝 Code Quality Assessment

File: .gitattributes

# Ensure shell scripts always use LF line endings on all platforms
*.sh text eol=lf

# Ensure other text files maintain consistent line endings
* text=auto

Positive aspects:

  • Clear, descriptive comments explain the purpose
  • *.sh text eol=lf correctly enforces LF for all shell scripts (entrypoint.sh:1, dev.sh:1)
  • * text=auto is a sensible default for other text files

Suggestions for improvement:

  1. Consider adding more file patterns for consistency:
# Ensure shell scripts always use LF line endings on all platforms
*.sh text eol=lf

# Ensure other script files use LF
*.bash text eol=lf
*.py text eol=lf

# Ensure configuration files maintain consistent line endings
*.yml text eol=lf
*.yaml text eol=lf
*.json text
*.md text

# Binary files
*.png binary
*.jpg binary
*.jpeg binary

# Ensure other text files maintain consistent line endings
* text=auto

This is optional but would provide more explicit control over line endings for the entire project.


🔒 Security Considerations

No security concerns identified. This change only affects how Git handles line endings in text files.


🐛 Potential Issues

  1. Existing clones won't auto-fix: The .gitattributes file only affects new checkouts. Existing Windows users need clear migration instructions.

  2. Instructions could be clearer: The PR mentions "Delete and re-clone the repository" but there's a less destructive alternative:

    git pull
    git rm --cached -r .
    git reset --hard
    docker-compose build --no-cache
  3. Consider adding this to documentation: The DOCKER.md file should be updated with troubleshooting information about line ending issues for Windows users.


⚡ Performance Considerations

No performance impact. Line ending normalization happens during Git operations only and doesn't affect runtime.


🧪 Test Coverage

Missing: There are no automated tests in this repository, but this change isn't easily unit-testable.

Recommendations:

  1. Manual testing required: A Windows contributor should verify the fix works after following the migration steps
  2. Consider adding a CI check that validates shell scripts have LF endings:
    - name: Check line endings
      run: |
        if git ls-files '*.sh' | xargs file | grep -q CRLF; then
          echo "Error: Shell scripts have CRLF line endings"
          exit 1
        fi

📋 Additional Recommendations

  1. Update DOCKER.md: Add a troubleshooting section:

    ### Troubleshooting: Windows Line Ending Issues
    
    If you encounter "file not found" errors with entrypoint.sh on Windows:
    1. Ensure you have the latest version with `.gitattributes`
    2. Re-normalize your repository:
       ```bash
       git pull
       git rm --cached -r .
       git reset --hard
       docker-compose build --no-cache
    
    
  2. Consider a validation script: Add a simple check in entrypoint.sh that fails early with a helpful message:

    #!/bin/sh
    # This is optional, but could help diagnose issues
  3. Document in README: Since this affects Docker setup, consider adding a note in the Docker section of README.md about the Windows fix.


✅ Final Verdict

APPROVED with minor suggestions

This is a solid, necessary fix that will prevent Windows users from encountering the issue described in #7. The implementation is correct and follows best practices.

Recommendation: Merge this PR as-is, and consider the suggestions above as follow-up improvements.

Breaking change? No, but existing Windows users need to follow migration steps.

Priority: High - this blocks Windows users from using Docker deployment.


📊 Review Score

  • Code Quality: 9/10 (Minor suggestion: more explicit file patterns)
  • Security: 10/10 (No concerns)
  • Performance: 10/10 (No impact)
  • Testing: 6/10 (No automated tests, but difficult to test this type of change)
  • Documentation: 8/10 (Good PR description, but could update DOCKER.md)

Overall: 8.6/10 - Excellent fix for a critical issue.


Reviewed by Claude Code - Automated code review

@curlysasha curlysasha closed this Jan 8, 2026
@curlysasha curlysasha deleted the claude/issue-7-20260107-1059 branch January 8, 2026 14:03
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.

Не находит entrypoint.sh

1 participant