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