diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-27 02:22:34 +0100 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2019-01-28 02:04:45 -0500 |
commit | 8cad84ccfbca7d9a3865c090e971c64700fd2ad5 (patch) | |
tree | 44d8ddc3488dd311760f94f5ed69be013e793aa8 /org.eclipse.jgit | |
parent | e7b4d108e19913362e92b17fa6ad5b7c9afba23f (diff) | |
download | jgit-8cad84ccfbca7d9a3865c090e971c64700fd2ad5.tar.gz jgit-8cad84ccfbca7d9a3865c090e971c64700fd2ad5.zip |
Fix GC.deleteEmptyRefsFolders
This method tried to iterate spurious files which may exist in the
.git/refs folder, e.g. on Mac a .DS_Store may have been created there by
inspecting the folder using the finder application. This led to a
NotDirectoryException when deleteEmptyRefsFolders tried to create an
iterator for such a file entry. Skip files contained in the refs folder
to ensure the method only tries to iterate contained folders but not
files.
Change-Id: I5f31e733072a35db1e93908a9c69a8891ae5c206
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index 037338e364..d4d6936a85 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -910,7 +910,8 @@ public class GC { // Avoid deleting a folder that was created after the threshold so that concurrent // operations trying to create a reference are not impacted Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS); - try (Stream<Path> entries = Files.list(refs)) { + try (Stream<Path> entries = Files.list(refs) + .filter(Files::isDirectory)) { Iterator<Path> iterator = entries.iterator(); while (iterator.hasNext()) { try (Stream<Path> s = Files.list(iterator.next())) { |