cowwoc commented on PR #392:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/392#issuecomment-3393903300

   ## Git-Style Permission Preservation Implemented
   
   I've updated the implementation to follow Git's approach of preserving only 
the owner executable bit, as you suggested.
   
   ### Changes
   
   The permission conversion methods now use Git's simplified model:
   
   **`permissionsToMode()`**: Only checks `OWNER_EXECUTE`, returns:
   - `0100755` (rwxr-xr-x) if executable
   - `0100644` (rw-r--r--) if not
   
   **`modeToPermissions()`**: Restores based on owner executable bit:
   - If set: rwxr-xr-x (0755)
   - If not: rw-r--r-- (0644)
   
   ### Why Git's Approach?
   
   Git only stores two file modes for regular files:
   - **100644** - Non-executable file
   - **100755** - Executable file
   
   This focuses on the **functional aspect (executability)** while ignoring 
platform-specific permission details that are generally irrelevant for 
cross-platform builds.
   
   ### Evidence
   
   From my research:
   - Git does NOT store: group permissions variations, others permissions 
variations, setuid/setgid/sticky bits
   - This is intentional for cross-platform portability
   - The approach has been proven across millions of repositories
   
   ### Benefits
   
   1. **Solves issue #214** - Preserves executable shell scripts
   2. **Cross-platform portable** - Works across Windows/macOS/Linux
   3. **Avoids cache invalidation** - Irrelevant permission differences don't 
trigger rebuilds
   4. **Simpler implementation** - Reduced from 87 lines to 34 lines
   5. **Proven model** - Follows Git's battle-tested approach
   
   ### Testing
   
   All tests pass, including `CacheUtilsPermissionsTest` which verifies:
   - ✅ Permission changes affect cache hash when `preservePermissions=true`
   - ✅ Permissions are NOT preserved when `preservePermissions=false`
   
   Ready for your review!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to