Browse Source

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>
tags/v5.5.0.201908280940-m3
Matthias Sohn 4 years ago
parent
commit
1553c94223

+ 5
- 7
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java View File



// Write the individual file entries. // Write the individual file entries.


final int smudge_s;
final int smudge_ns;
Instant smudge;
if (myLock != null) { if (myLock != null) {
// For new files we need to smudge the index entry // For new files we need to smudge the index entry
// if they have been modified "now". Ideally we'd // if they have been modified "now". Ideally we'd
// so we use the current timestamp as a approximation. // so we use the current timestamp as a approximation.
myLock.createCommitSnapshot(); myLock.createCommitSnapshot();
snapshot = myLock.getCommitSnapshot(); snapshot = myLock.getCommitSnapshot();
smudge_s = (int) (snapshot.lastModifiedInstant().getEpochSecond());
smudge_ns = snapshot.lastModifiedInstant().getNano();
smudge = snapshot.lastModifiedInstant();
} else { } else {
// Used in unit tests only // Used in unit tests only
smudge_ns = 0;
smudge_s = 0;
smudge = Instant.EPOCH;
} }


// Check if tree is non-null here since calling updateSmudgedEntries // Check if tree is non-null here since calling updateSmudgedEntries


for (int i = 0; i < entryCnt; i++) { for (int i = 0; i < entryCnt; i++) {
final DirCacheEntry e = sortedEntries[i]; final DirCacheEntry e = sortedEntries[i];
if (e.mightBeRacilyClean(smudge_s, smudge_ns))
if (e.mightBeRacilyClean(smudge)) {
e.smudgeRacilyClean(); e.smudgeRacilyClean();
}
e.write(dos); e.write(dos);
} }



+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java View File

// //
final int base = infoOffset + P_MTIME; final int base = infoOffset + P_MTIME;
final int mtime = NB.decodeInt32(info, base); 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 smudge.getNano() <= NB.decodeInt32(info, base + 4);
} }
return false; return false;

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java View File

return attributes.getLastModifiedInstant().toEpochMilli(); return attributes.getLastModifiedInstant().toEpochMilli();
} }


/**
* @since 5.1.9
*/
@Override @Override
public Instant getLastModifiedInstant() { public Instant getLastModifiedInstant() {
return attributes.getLastModifiedInstant(); return attributes.getLastModifiedInstant();

Loading…
Cancel
Save