aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorMichael Keppler <Michael.Keppler@gmx.de>2019-08-20 16:09:12 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-21 00:07:49 +0200
commit6cb21049d7a48dbc4384fe98a3d3093eb457e381 (patch)
tree7701e1d09b492a2ba74ae53eb3ad8532d58317ca /org.eclipse.jgit/src
parent86a567f6152315f5d55309c7119885d0fa3476ce (diff)
downloadjgit-6cb21049d7a48dbc4384fe98a3d3093eb457e381.tar.gz
jgit-6cb21049d7a48dbc4384fe98a3d3093eb457e381.zip
Fix deprecation in DirCache caused by Instant based DirCacheEntry
Replace the two int variables smudge_s and smudge_ns by an Instant and use the new method DirCacheEntry.mightBeRacilyClean(Instant). Change-Id: Id70adbb0856a64909617acf65da1bae8e2ae934a Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index 0cfd16b58a..a778de910b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -671,8 +671,7 @@ public class DirCache {
// Write the individual file entries.
- final int smudge_s;
- final int smudge_ns;
+ Instant smudge;
if (myLock != null) {
// For new files we need to smudge the index entry
// if they have been modified "now". Ideally we'd
@@ -680,12 +679,10 @@ public class DirCache {
// so we use the current timestamp as a approximation.
myLock.createCommitSnapshot();
snapshot = myLock.getCommitSnapshot();
- smudge_s = (int) (snapshot.lastModifiedInstant().getEpochSecond());
- smudge_ns = snapshot.lastModifiedInstant().getNano();
+ smudge = snapshot.lastModifiedInstant();
} else {
// Used in unit tests only
- smudge_ns = 0;
- smudge_s = 0;
+ smudge = Instant.EPOCH;
}
// Check if tree is non-null here since calling updateSmudgedEntries
@@ -697,8 +694,9 @@ public class DirCache {
for (int i = 0; i < entryCnt; i++) {
final DirCacheEntry e = sortedEntries[i];
- if (e.mightBeRacilyClean(smudge_s, smudge_ns))
+ if (e.mightBeRacilyClean(smudge)) {
e.smudgeRacilyClean();
+ }
e.write(dos);
}