+ ": commit message lines >70 characters; manually wrap lines");
}
}
private void autoCloseChanges(final ReceiveCommand cmd) {
final RevWalk rw = rp.getRevWalk();
try {
rw.reset();
rw.markStart(rw.parseCommit(cmd.getNewId()));
if (!ObjectId.zeroId().equals(cmd.getOldId())) {
rw.markUninteresting(rw.parseCommit(cmd.getOldId()));
}
final Map<ObjectId, Ref> byCommit = changeRefsById();
final Map<Change.Key, Change.Id> byKey = openChangesByKey(
new Branch.NameKey(project.getNameKey(), cmd.getRefName()));
final List<ReplaceRequest> toClose = new ArrayList<ReplaceRequest>();
RevCommit c;
while ((c = rw.next()) != null) {
final Ref ref = byCommit.get(c.copy());
if (ref != null) {
rw.parseBody(c);
closeChange(cmd, PatchSet.Id.fromRef(ref.getName()), c);
closeProgress.update(1);
}
rw.parseBody(c);
for (final String changeId : c.getFooterLines(CHANGE_ID)) {
final Change.Id onto = byKey.get(new Change.Key(changeId.trim()));
if (onto != null) {
toClose.add(new ReplaceRequest(onto, c, cmd, false));
break;
}
}
}
for (final ReplaceRequest req : toClose) {
final PatchSet.Id psi = doReplace(req, true);
if (psi != null) {
closeChange(req.cmd, psi, req.newCommit);
closeProgress.update(1);
}
}
// It handles gitlinks if required.
rw.reset();
final RevCommit codeReviewCommit = rw.parseCommit(cmd.getNewId());
final SubmoduleOp subOp =
subOpFactory.create(
new Branch.NameKey(project.getNameKey(), cmd.getRefName()),
codeReviewCommit, rw, repo, project, new ArrayList<Change>(),