Change kind cache: short-circuit on root commits

See our stack trace at

https://phabricator.wikimedia.org/P5612

It's leading us to this
c7746ffec7/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java (L261)
Line

Bug: Issue 8558
Change-Id: I4861b98e309a32c3c11a40dd0e4675c5ecb846a8
This commit is contained in:
Paladox none
2017-06-21 23:48:31 +00:00
committed by David Pursehouse
parent f7c63f620a
commit b60e7029c0

View File

@@ -224,8 +224,15 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
return ChangeKind.NO_CHANGE;
}
if ((prior.getParentCount() != 1 || next.getParentCount() != 1)
&& (!onlyFirstParentChanged(prior, next) || prior.getParentCount() == 0)) {
if (prior.getParentCount() == 0 || next.getParentCount() == 0) {
// At this point we have considered all the kinds that could be applicable to root
// commits; the remainder of the checks in this method all assume that both commits have
// at least one parent.
return ChangeKind.REWORK;
}
if ((prior.getParentCount() > 1 || next.getParentCount() > 1)
&& !onlyFirstParentChanged(prior, next)) {
// Trivial rebases done by machine only work well on 1 parent.
return ChangeKind.REWORK;
}