summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-05-10 00:58:42 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-05-29 23:41:45 +0200
commit43b06f51f96dddc3d512904f9e1f0bb6b5cc5984 (patch)
treec558041207add2b0b95b3a30b1ee6b583ce6fff7 /org.eclipse.jgit.test
parentd31a0c0b5dbdc35cca78beb72df3d75551142d6b (diff)
downloadjgit-43b06f51f96dddc3d512904f9e1f0bb6b5cc5984.tar.gz
jgit-43b06f51f96dddc3d512904f9e1f0bb6b5cc5984.zip
Capture reason for result of FileSnapshot#isModified
This allows to verify the expected behavior in FileSnapshotTest#testSimulatePackfileReplacement and enables extending FileSnapshot for packfiles to read the packfile's checksum as another criterion to detect modifications without reading the full content. Also add another field capturing the result of the last check if lastModified was racily clean. Remove unnecessary determination of raciness in the constructor. It was determined twice in all relevant cases. Change-Id: I100a2f49d7949693d7b72daa89437e166f1dc107 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
index 6ef87d8b02..79ede96919 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.internal.storage.file;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -154,6 +155,12 @@ public class FileSnapshotTest {
StandardCopyOption.ATOMIC_MOVE);
Files.setLastModifiedTime(f1.toPath(), timestamp);
assertTrue(save.isModified(f1));
+ assertTrue("unexpected change of fileKey", save.wasFileKeyChanged());
+ assertFalse("unexpected size change", save.wasSizeChanged());
+ assertFalse("unexpected lastModified change",
+ save.wasLastModifiedChanged());
+ assertFalse("lastModified was unexpectedly racily clean",
+ save.wasLastModifiedRacilyClean());
}
private File createFile(String string) throws IOException {