Merge "DirCacheEntry: UPDATE_NEEDED should be in-core flag."

This commit is contained in:
Shawn Pearce 2010-08-31 14:29:03 -04:00 committed by Code Review
commit b3aa5802b9
1 changed files with 8 additions and 4 deletions

View File

@ -116,7 +116,8 @@ public class DirCacheEntry {
private static final int ASSUME_VALID = 0x80; private static final int ASSUME_VALID = 0x80;
private static final int UPDATE_NEEDED = 0x40; /** In-core flag signaling that the entry should be considered as modified. */
private static final int UPDATE_NEEDED = 0x1;
/** (Possibly shared) header information storage. */ /** (Possibly shared) header information storage. */
private final byte[] info; private final byte[] info;
@ -127,6 +128,9 @@ public class DirCacheEntry {
/** Our encoded path name, from the root of the repository. */ /** Our encoded path name, from the root of the repository. */
final byte[] path; final byte[] path;
/** Flags which are never stored to disk. */
private byte inCoreFlags;
DirCacheEntry(final byte[] sharedInfo, final int infoAt, DirCacheEntry(final byte[] sharedInfo, final int infoAt,
final InputStream in, final MessageDigest md) throws IOException { final InputStream in, final MessageDigest md) throws IOException {
info = sharedInfo; info = sharedInfo;
@ -370,7 +374,7 @@ public void setAssumeValid(final boolean assume) {
* @return true if this entry should be checked for changes * @return true if this entry should be checked for changes
*/ */
public boolean isUpdateNeeded() { public boolean isUpdateNeeded() {
return (info[infoOffset + P_FLAGS] & UPDATE_NEEDED) != 0; return (inCoreFlags & UPDATE_NEEDED) != 0;
} }
/** /**
@ -380,9 +384,9 @@ public boolean isUpdateNeeded() {
*/ */
public void setUpdateNeeded(boolean updateNeeded) { public void setUpdateNeeded(boolean updateNeeded) {
if (updateNeeded) if (updateNeeded)
info[infoOffset + P_FLAGS] |= UPDATE_NEEDED; inCoreFlags |= UPDATE_NEEDED;
else else
info[infoOffset + P_FLAGS] &= ~UPDATE_NEEDED; inCoreFlags &= ~UPDATE_NEEDED;
} }
/** /**