}
/**
- * Get mutable map of all known refs
+ * Get mutable map of all known refs, including symrefs like HEAD that may
+ * not point to any object yet.
*
* @return mutable map of all known refs (heads, tags, remotes).
*/
if (options.contains(OPTION_INCLUDE_TAG) && refs != null) {
for (Ref ref : refs.values()) {
ObjectId objectId = ref.getObjectId();
+ if (objectId == null) {
+ // skip unborn branch
+ continue;
+ }
// If the object was already requested, skip it.
if (wantAll.isEmpty()) {
ref = db.peel(ref);
ObjectId peeledId = ref.getPeeledObjectId();
- if (peeledId == null)
+ objectId = ref.getObjectId();
+ if (peeledId == null || objectId == null)
continue;
- objectId = ref.getObjectId();
- if (pw.willInclude(peeledId) && !pw.willInclude(objectId))
+ if (pw.willInclude(peeledId) && !pw.willInclude(objectId)) {
pw.addObject(rw.parseAny(objectId));
+ }
}
}