From 7828ef349cfb671cf9673d766a420c032d7ffb45 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Sun, 26 Dec 2021 15:35:30 +0100 Subject: [PATCH] Revert "RefDirectory.scanRef: Re-use file existence check done in snapshot creation" This reverts commit f829f5f838e0f9c17373ea6cb3407976a8f395ff. Using MISSING_FILEKEY as indicator for a non-existing file doesn't work on Windows. Bug: 577954 Change-Id: I92102a3d259f6cc0f367096a3213cfa794466817 Signed-off-by: Thomas Wolf --- .../eclipse/jgit/internal/storage/file/FileSnapshot.java | 9 --------- .../eclipse/jgit/internal/storage/file/RefDirectory.java | 4 ---- 2 files changed, 13 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java index 654e98d81..487ae0601 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java @@ -439,15 +439,6 @@ public boolean equals(Object obj) { return equals(other); } - /** - * Check if the file exists - * - * @return true if the file exists - */ - public boolean fileExists() { - return !MISSING_FILEKEY.equals(this.fileKey); - } - /** {@inheritDoc} */ @Override public int hashCode() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index c34be9cc0..0b8e0797e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -1103,10 +1103,6 @@ LooseRef scanRef(LooseRef ref, String name) throws IOException { final int limit = 4096; final byte[] buf; FileSnapshot otherSnapshot = FileSnapshot.save(path); - if (!otherSnapshot.fileExists()) { - return null; - } - try { buf = IO.readSome(path, limit); } catch (FileNotFoundException noFile) {