Correctly handle missing refs/meta/config branch

If the refs/meta/config branch does not exist, getRevision() used to
throw NPE when trying to access the ProjectDetail. This is because
on a missing branch the revision field is null, and must return a
null to the caller rather than copying the value.

Change-Id: If4dd771d39382b89443a234f16d13a7a4e6838c8
This commit is contained in:
Shawn O. Pearce
2011-06-13 09:24:59 -07:00
parent 600226a25e
commit 0fb80b5133

View File

@@ -66,7 +66,7 @@ public abstract class VersionedMetaData {
/** @return revision of the metadata that was loaded. */
public ObjectId getRevision() {
return revision.copy();
return revision != null ? revision.copy() : null;
}
/** Initialize in-memory as though the repository branch doesn't exist. */