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 List<FooterLine> footerLines = commit.getFooterLines();
final MailRecipients recipients = new MailRecipients(); final MailRecipients recipients = new MailRecipients();
Map<String, Short> approvals = new HashMap<>(); Map<String, Short> approvals = new HashMap<>();
if (magicBranch != null) { checkNotNull(magicBranch);
recipients.add(magicBranch.getMailRecipients()); recipients.add(magicBranch.getMailRecipients());
approvals = magicBranch.labels; approvals = magicBranch.labels;
}
recipients.add(getRecipientsFromFooters( recipients.add(getRecipientsFromFooters(
accountResolver, magicBranch.draft, footerLines)); accountResolver, magicBranch.draft, footerLines));
recipients.remove(me); recipients.remove(me);
@@ -1802,7 +1801,6 @@ public class ReceiveCommits {
.setRequestScopePropagator(requestScopePropagator) .setRequestScopePropagator(requestScopePropagator)
.setSendMail(true) .setSendMail(true)
.setUpdateRef(true)); .setUpdateRef(true));
if (magicBranch != null) {
bu.addOp( bu.addOp(
changeId, changeId,
hashtagsFactory.create(new HashtagsInput(magicBranch.hashtags)) hashtagsFactory.create(new HashtagsInput(magicBranch.hashtags))
@@ -1818,12 +1816,11 @@ public class ReceiveCommits {
} }
}); });
} }
}
bu.execute(); bu.execute();
} }
change = ins.getChange(); change = ins.getChange();
if (magicBranch != null && magicBranch.submit) { if (magicBranch.submit) {
submit(projectControl.controlFor(state.db, change), ins.getPatchSet()); submit(projectControl.controlFor(state.db, change), ins.getPatchSet());
} }
} }