ReceiveCommits: Remove redundant null checks of magic branch

Change-Id: I53532a27c700416e4fe50ce5c7b910347a11aa15
This commit is contained in:
David Pursehouse
2016-02-12 11:10:57 +09:00
parent bd19d9a380
commit e68af5dfe9

View File

@@ -1782,10 +1782,9 @@ public class ReceiveCommits {
final List<FooterLine> footerLines = commit.getFooterLines();
final MailRecipients recipients = new MailRecipients();
Map<String, Short> approvals = new HashMap<>();
if (magicBranch != null) {
recipients.add(magicBranch.getMailRecipients());
approvals = magicBranch.labels;
}
checkNotNull(magicBranch);
recipients.add(magicBranch.getMailRecipients());
approvals = magicBranch.labels;
recipients.add(getRecipientsFromFooters(
accountResolver, magicBranch.draft, footerLines));
recipients.remove(me);
@@ -1802,28 +1801,26 @@ public class ReceiveCommits {
.setRequestScopePropagator(requestScopePropagator)
.setSendMail(true)
.setUpdateRef(true));
if (magicBranch != null) {
bu.addOp(
changeId,
hashtagsFactory.create(new HashtagsInput(magicBranch.hashtags))
.setRunHooks(false));
if (!Strings.isNullOrEmpty(magicBranch.topic)) {
bu.addOp(
changeId,
hashtagsFactory.create(new HashtagsInput(magicBranch.hashtags))
.setRunHooks(false));
if (!Strings.isNullOrEmpty(magicBranch.topic)) {
bu.addOp(
changeId,
new BatchUpdate.Op() {
@Override
public boolean updateChange(ChangeContext ctx) {
ctx.getUpdate(psId).setTopic(magicBranch.topic);
return true;
}
});
}
new BatchUpdate.Op() {
@Override
public boolean updateChange(ChangeContext ctx) {
ctx.getUpdate(psId).setTopic(magicBranch.topic);
return true;
}
});
}
bu.execute();
}
change = ins.getChange();
if (magicBranch != null && magicBranch.submit) {
if (magicBranch.submit) {
submit(projectControl.controlFor(state.db, change), ins.getPatchSet());
}
}