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 55d075124..eb5c1db50 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 @@ -884,7 +884,7 @@ private static boolean isTag(Ref ref) { } private void deleteEmptyRefsFolders() throws IOException { - Path refs = repo.getDirectory().toPath().resolve("refs"); //$NON-NLS-1$ + Path refs = repo.getDirectory().toPath().resolve(Constants.R_REFS); try (Stream entries = Files.list(refs)) { Iterator iterator = entries.iterator(); while (iterator.hasNext()) { @@ -908,7 +908,7 @@ private boolean isDirectory(Path p) { return p.toFile().isDirectory(); } - private boolean delete(Path d) { + private void delete(Path d) { try { // Avoid deleting a folder that was just created so that concurrent // operations trying to create a reference are not impacted @@ -918,12 +918,12 @@ private boolean delete(Path d) { // If the folder is not empty, the delete operation will fail // silently. This is a cheaper alternative to filtering the // stream in the calling method. - return d.toFile().delete(); + Files.delete(d); } } catch (IOException e) { - LOG.error(e.getMessage(), e); + LOG.error(MessageFormat.format(JGitText.get().cannotDeleteFile, d), + e); } - return false; } /**