summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2022-01-31 09:39:12 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2022-02-01 00:05:53 +0100
commit8dcb86b602c02f8f3f310f2b3a5b13ef4bb5f11b (patch)
tree12b5939d86a5f81f830cd5483aea9156dec0403e /org.eclipse.jgit
parent0588dd0a9f7a86a7a854da444a9a27d2eabb2a66 (diff)
downloadjgit-8dcb86b602c02f8f3f310f2b3a5b13ef4bb5f11b.tar.gz
jgit-8dcb86b602c02f8f3f310f2b3a5b13ef4bb5f11b.zip
Fix FS_Win32 if a non-directory is listed
FS.list() is supposed to return an empty array if the File given is not a directory. Bug: 550111 Change-Id: I245da5f1f2bdafd9dfb38fb8d7eff27d900cd5a8 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
index ff094f6975..ae73d3feb8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java
@@ -16,6 +16,7 @@ import java.io.IOException;
import java.nio.file.FileVisitOption;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
+import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
@@ -96,6 +97,9 @@ public class FS_Win32 extends FS {
/** {@inheritDoc} */
@Override
public Entry[] list(File directory, FileModeStrategy fileModeStrategy) {
+ if (!Files.isDirectory(directory.toPath(), LinkOption.NOFOLLOW_LINKS)) {
+ return NO_ENTRIES;
+ }
List<Entry> result = new ArrayList<>();
FS fs = this;
boolean checkExecutable = fs.supportsExecute();