Repository navigation
Conversation
| <action type="fix" dev="ggregory" due-to="Gary Gregory">StringUtils now uses the JVM default charset for null charset names in getBytesUnchecked and newString.</action> | ||
| <action type="fix" dev="ggregory" due-to="Gary Gregory">BCodec.encode(String, String) now wraps illegal charset names in EncoderException, consistent with unsupported charset names.</action> | ||
| <action type="fix" dev="ggregory" due-to="Gary Gregory">QCodec.encode(String, String) now wraps illegal charset names in EncoderException, consistent with unsupported charset names.</action> <!-- ADD --> | ||
| <action type="fix" dev="ggregory" due-to="Gary Gregory">QCodec.encode(String, String) now wraps illegal charset names in EncoderException, consistent with unsupported charset names.</action> |
There was a problem hiding this comment.
Removed. src/changes/changes.xml is no longer touched: the branch is the Java change plus the regression test only, now at fa2997c (2 files, +29/-1).
The CI run on the previous head was green (10 checks, including Java CI); I cannot tell yet whether the new head needs another approval before it runs, and I am not claiming one.
I left the pull request as a draft, as you asked, and will not touch src/changes/changes.xml in any of my open pull requests.
|
Convert to draft until review. |
194f644 to
fa2997c
Compare
| // Windows reports every readable file as executable. Git records the executable bit only where the file system | ||
| // provides POSIX permissions; elsewhere, for example with Git for Windows and its default core.fileMode=false, | ||
| // regular files are stored as 100644. | ||
| if (Files.getFileAttributeView(path, PosixFileAttributeView.class) != null && Files.isExecutable(path)) { |
There was a problem hiding this comment.
Nit: since we are retrieving the file attributes, we might as well use them. We could for example:
-
Retrieve an attribute view:
BasicFileAttributeView view = Files.getFileAttributeView(path, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS); if (view == null) { view = Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS); } BasicFileAttributes attrs = view.readAttributes();
-
Use
attrs.isSymbolicLink(),attrs.isDirectory()and((PosixFileAttributes) attrs).permissions().contains(PosixFilePermission.OWNER_EXECUTE);
to classify the file.
There was a problem hiding this comment.
Done on 8e8a5d2 — thanks, this is cleaner than the three separate calls. FileMode.get now reads one attribute set: it asks for the PosixFileAttributeView with NOFOLLOW_LINKS, falls back to BasicFileAttributeView when the file system has no POSIX view, classifies with attrs.isSymbolicLink() / attrs.isDirectory(), and uses ((PosixFileAttributes) attrs).permissions().contains(PosixFilePermission.OWNER_EXECUTE) for the executable bit. get now declares IOException, which its only caller (populate) already throws.
Local evidence on Windows 10 / JDK 17.0.11:
- the three non-symlink
GitIdentifiersTestcases this change covers: 3 run, 0 failures - full
mvn -B -ntp -o -Dmaven.repo.local=G:/pr/tools/m2local test: 19971 run, 0 failures, 3 errors, 20 skipped — the 3 errors are the pre-existing Windows symlink-privilege failures intestBlobIdSymlink/testTreeIdPathUnix, unrelated to this change; the two GitIdentifiers Windows failures this PR fixes are gone
The PR description now shows the attribute-view implementation. The PR is still a draft; CI on the new head is action_required again, so the local run is the only executed evidence.
Files.isExecutable(Path) returns true for every readable file on the default Windows file system, so treeId(Path) recorded all regular files with mode 100755 instead of 100644 and produced tree identifiers that differ from Git's. Git records the executable bit only where the file system exposes POSIX permissions; with its default core.fileMode=false on Windows it stores regular files as 100644. The executable bit is now used only when the file has a POSIX attribute view. On a POSIX file system the view is present and Files.isExecutable stays authoritative, so the behaviour there is unchanged. Add a regression test. Existing GitIdentifiersTest.testTreeIdPath and testTreeIdSortsSupplementaryPlaneNamesLikeGit now pass on Windows. Assisted-By: DeepSeek dsv41
fa2997c to
8e8a5d2
Compare
GitIdentifiers.treeId(Path)records every file as mode100755on Windows, so the tree identifiers it computes do not match Git's.Files.isExecutable(Path)is the only test used to choose between100644and100755, 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 defaultcore.fileMode=falseon Windows, every regular file is stored as100644. The same applies to any file system without POSIX permissions.The mode is now classified from one attribute set, preferring the POSIX view where the file system provides it and falling back to the basic view elsewhere:
attrs.isSymbolicLink()andattrs.isDirectory()classify the entry, and only the POSIX permission bits carry the owner-execute bit Git records. On a POSIX file system the POSIX view is present, so the executable bit is used exactly as before; on a file system without it the file is100644. This also replaces the separateFiles.isSymbolicLink/isDirectory/isExecutablecalls with one attribute read, following the review suggestion.Test
GitIdentifiersTest.testTreeIdPathRecordsFilesWithoutPosixExecutableBitAsRegularcomparesGitIdentifiers.treeId(Path)on a temporary directory with a tree built throughTreeIdBuilder, so it fails while the path-based tree still uses the executable bit for an ordinary file. Two existing tests,testTreeIdPathandtestTreeIdSortsSupplementaryPlaneNamesLikeGit, 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:testTreeIdPath,testTreeIdPathRecordsFilesWithoutPosixExecutableBitAsRegular,testTreeIdSortsSupplementaryPlaneNamesLikeGit), plus 3 errors from the symlink tests that need a Windows privilege this host does not havetestTreeIdPath,testTreeIdSortsSupplementaryPlaneNamesLikeGit,testTreeIdPathRecordsFilesWithoutPosixExecutableBitAsRegular): 3 run, 0 failuresmvn -B -ntp -o -Dmaven.repo.local=G:/pr/tools/m2local test: 19971 run, 0 failures, 3 errors (the same Windows symlink-privilege errors), 20 skippedLinux 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. CI on this repository is currently
action_required(first contribution from this fork), so the numbers above are local only.The commit carries an
Assisted-By:trailer, asAGENTS.mdasks.