summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java43
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java4
2 files changed, 24 insertions, 23 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java
index 90fd38bdeb..0590f905ec 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java
@@ -493,8 +493,9 @@ public class RefDirectory extends RefDatabase {
return leaf;
}
- void storedSymbolicRef(RefDirectoryUpdate u, long modified, String target) {
- putLooseRef(newSymbolicRef(modified, u.getRef().getName(), target));
+ void storedSymbolicRef(RefDirectoryUpdate u, FileSnapshot snapshot,
+ String target) {
+ putLooseRef(newSymbolicRef(snapshot, u.getRef().getName(), target));
fireRefsChanged();
}
@@ -526,10 +527,10 @@ public class RefDirectory extends RefDatabase {
return new RefDirectoryRename(from, to);
}
- void stored(RefDirectoryUpdate update, long modified) {
+ void stored(RefDirectoryUpdate update, FileSnapshot snapshot) {
final ObjectId target = update.getNewObjectId().copy();
final Ref leaf = update.getRef().getLeaf();
- putLooseRef(new LooseUnpeeled(modified, leaf.getName(), target));
+ putLooseRef(new LooseUnpeeled(snapshot, leaf.getName(), target));
}
private void putLooseRef(LooseRef ref) {
@@ -852,8 +853,7 @@ public class RefDirectory extends RefDatabase {
if (!currentSnapshot.isModified(path))
return ref;
name = ref.getName();
- } else if (!path.exists())
- return null;
+ }
final int limit = 4096;
final byte[] buf;
@@ -885,7 +885,7 @@ public class RefDirectory extends RefDatabase {
currentSnapshot.setClean(otherSnapshot);
return ref;
}
- return newSymbolicRef(path.lastModified(), name, target);
+ return newSymbolicRef(otherSnapshot, name, target);
}
if (n < OBJECT_ID_STRING_LENGTH)
@@ -906,7 +906,7 @@ public class RefDirectory extends RefDatabase {
String content = RawParseUtils.decode(buf, 0, n);
throw new IOException(MessageFormat.format(JGitText.get().notARef, name, content));
}
- return new LooseUnpeeled(path.lastModified(), name, id);
+ return new LooseUnpeeled(otherSnapshot, name, id);
}
private static boolean isSymRef(final byte[] buf, int n) {
@@ -1004,10 +1004,10 @@ public class RefDirectory extends RefDatabase {
}
}
- private static LooseSymbolicRef newSymbolicRef(long lastModified,
+ private static LooseSymbolicRef newSymbolicRef(FileSnapshot snapshot,
String name, String target) {
Ref dst = new ObjectIdRef.Unpeeled(NEW, target, null);
- return new LooseSymbolicRef(lastModified, name, dst);
+ return new LooseSymbolicRef(snapshot, name, dst);
}
private static interface LooseRef extends Ref {
@@ -1020,9 +1020,10 @@ public class RefDirectory extends RefDatabase {
implements LooseRef {
private final FileSnapshot snapShot;
- LoosePeeledTag(long mtime, String refName, ObjectId id, ObjectId p) {
+ LoosePeeledTag(FileSnapshot snapshot, String refName, ObjectId id,
+ ObjectId p) {
super(LOOSE, refName, id, p);
- snapShot = FileSnapshot.save(mtime);
+ this.snapShot = snapshot;
}
public FileSnapshot getSnapShot() {
@@ -1038,9 +1039,9 @@ public class RefDirectory extends RefDatabase {
implements LooseRef {
private final FileSnapshot snapShot;
- LooseNonTag(long mtime, String refName, ObjectId id) {
+ LooseNonTag(FileSnapshot snapshot, String refName, ObjectId id) {
super(LOOSE, refName, id);
- snapShot = FileSnapshot.save(mtime);
+ this.snapShot = snapshot;
}
public FileSnapshot getSnapShot() {
@@ -1054,11 +1055,11 @@ public class RefDirectory extends RefDatabase {
private final static class LooseUnpeeled extends ObjectIdRef.Unpeeled
implements LooseRef {
- private final FileSnapshot snapShot;
+ private FileSnapshot snapShot;
- LooseUnpeeled(long mtime, String refName, ObjectId id) {
+ LooseUnpeeled(FileSnapshot snapShot, String refName, ObjectId id) {
super(LOOSE, refName, id);
- snapShot = FileSnapshot.save(mtime);
+ this.snapShot = snapShot;
}
public FileSnapshot getSnapShot() {
@@ -1067,10 +1068,10 @@ public class RefDirectory extends RefDatabase {
public LooseRef peel(ObjectIdRef newLeaf) {
if (newLeaf.getPeeledObjectId() != null)
- return new LoosePeeledTag(snapShot.lastModified(), getName(),
+ return new LoosePeeledTag(snapShot, getName(),
getObjectId(), newLeaf.getPeeledObjectId());
else
- return new LooseNonTag(snapShot.lastModified(), getName(),
+ return new LooseNonTag(snapShot, getName(),
getObjectId());
}
}
@@ -1079,9 +1080,9 @@ public class RefDirectory extends RefDatabase {
LooseRef {
private final FileSnapshot snapShot;
- LooseSymbolicRef(long mtime, String refName, Ref target) {
+ LooseSymbolicRef(FileSnapshot snapshot, String refName, Ref target) {
super(refName, target);
- snapShot = FileSnapshot.save(mtime);
+ this.snapShot = snapshot;
}
public FileSnapshot getSnapShot() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java
index 109960df2b..b9f0e14efc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectoryUpdate.java
@@ -121,7 +121,7 @@ class RefDirectoryUpdate extends RefUpdate {
}
if (!lock.commit())
return Result.LOCK_FAILURE;
- database.stored(this, lock.getCommitLastModified());
+ database.stored(this, lock.getCommitSnapshot());
return status;
}
@@ -159,7 +159,7 @@ class RefDirectoryUpdate extends RefUpdate {
database.log(this, msg, false);
if (!lock.commit())
return Result.LOCK_FAILURE;
- database.storedSymbolicRef(this, lock.getCommitLastModified(), target);
+ database.storedSymbolicRef(this, lock.getCommitSnapshot(), target);
if (getRef().getStorage() == Ref.Storage.NEW)
return Result.NEW;