Browse Source

Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  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: If6d5f4dfd9fc8e8c09e29aa11b1004057eafeb9f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.3
Matthias Sohn 5 years ago
parent
commit
48498fd3e6
  1. 12
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
  3. 3
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java

12
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java vendored

@ -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);
}

2
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java vendored

@ -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;

3
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();

Loading…
Cancel
Save