simpleqt opened a new pull request, #458:
URL: https://github.com/apache/commons-codec/pull/458
`GitIdentifiers.treeId(Path)` records every file as mode `100755` on
Windows, so the tree identifiers it computes do not match Git's.
`Files.isExecutable(Path)` is the only test used to choose between `100644`
and `100755`, and on the default Windows file system every readable file
reports as executable. Git records the executable bit only where the file
system exposes POSIX permissions; with its default `core.fileMode=false` on
Windows, every regular file is stored as `100644`. The same applies to any file
system without POSIX permissions.
The executable bit is now used only when the file has a POSIX attribute view:
```java
if (Files.getFileAttributeView(path, PosixFileAttributeView.class) != null
&& Files.isExecutable(path)) {
return EXECUTABLE;
}
```
On a POSIX file system the view is present and `Files.isExecutable` stays
authoritative, so the behaviour there is unchanged.
## Test
`GitIdentifiersTest.testTreeIdPathRecordsFilesWithoutPosixExecutableBitAsRegular`
compares `GitIdentifiers.treeId(Path)` on a temporary directory with a tree
built through `TreeIdBuilder`, so it fails while the path-based tree still uses
the executable bit for an ordinary file. Two existing tests, `testTreeIdPath`
and `testTreeIdSortsSupplementaryPlaneNamesLikeGit`, fail on Windows for the
same reason and pass with the change.
Local results on Windows 10, JDK 17.0.11, `mvn -B -o
-Dtest=GitIdentifiersTest test`:
- with the source change reverted: 55 run, 0 failures before the new test is
considered, 3 failures once it is included (`testTreeIdPath`,
`testTreeIdPathRecordsFilesWithoutPosixExecutableBitAsRegular`,
`testTreeIdSortsSupplementaryPlaneNamesLikeGit`), plus 3 errors from the
symlink tests that need a Windows privilege this host does not have
- with the change: 55 run, 0 failures, and the same 3 symlink errors, which
are environmental and unrelated to this change
Linux and macOS CI are the first runs on a POSIX file system; the changed
branch is a single guard, and the POSIX path keeps its previous behaviour.
The commit carries an `Assisted-By:` trailer, as `AGENTS.md` asks.
--
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]