aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-08-21 22:39:34 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-21 22:39:47 +0200
commit1553c94223413bd7c6d0d423da3ab6fc1eb89732 (patch)
tree8834fbdc6059916e5a1cc143036a605b55325931 /org.eclipse.jgit/src
parent2d0f1c1dc11fd445d3137b1f2fa49f88bbd48bb5 (diff)
parent2eb83f4b4ac77d1647cfcf0a06df44eb22f15da7 (diff)
downloadjgit-1553c94223413bd7c6d0d423da3ab6fc1eb89732.tar.gz
jgit-1553c94223413bd7c6d0d423da3ab6fc1eb89732.zip
Merge branch 'stable-5.4'
* stable-5.4: Prepare 5.4.2-SNAPSHOT builds JGit v5.4.1.201908211225-r Prepare 5.3.4-SNAPSHOT builds JGit v5.3.3.201908210735-r Add missing @since tag on FileTreeIterator#getLastModifiedInstant Prepare 5.1.10-SNAPSHOT builds JGit v5.1.9.201908210455-r Avoid sign extension when comparing mtime with Instant#getEpochSecond Fix deprecation in DirCache caused by Instant based DirCacheEntry Change-Id: I63156d6b73044d5d8820869a397a0aa94e607b50 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
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java3
3 files changed, 9 insertions, 8 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 95e1d21434..f07c24efc4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -657,8 +657,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
@@ -666,12 +665,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
@@ -683,8 +680,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);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
index d4db15ce9b..0e91f0d748 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
@@ -378,7 +378,7 @@ public class DirCacheEntry {
//
final int base = infoOffset + P_MTIME;
final int mtime = NB.decodeInt32(info, base);
- if (smudge.getEpochSecond() == mtime) {
+ if ((int) smudge.getEpochSecond() == mtime) {
return smudge.getNano() <= NB.decodeInt32(info, base + 4);
}
return false;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index d432c94450..4f3eb05b11 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -412,6 +412,9 @@ public class FileTreeIterator extends WorkingTreeIterator {
return attributes.getLastModifiedInstant().toEpochMilli();
}
+ /**
+ * @since 5.1.9
+ */
@Override
public Instant getLastModifiedInstant() {
return attributes.getLastModifiedInstant();