summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaladox none <thomasmulhall410@yahoo.com>2017-06-21 23:48:31 +0000
committerDavid Pursehouse <dpursehouse@collab.net>2018-03-16 16:40:01 +0900
commitb60e7029c03fab793f17528adb92dbff56015313 (patch)
treecd992d548861e6449c889489e6731a4f117c2f71
parentf7c63f620a4b273084806d3ee4546f3761ed47bc (diff)
Change kind cache: short-circuit on root commits
See our stack trace at https://phabricator.wikimedia.org/P5612 It's leading us to this https://github.com/GerritCodeReview/gerrit/blob/c7746ffec770953c22d9b88d658e6f526db09a59/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java#L261 Line Bug: Issue 8558 Change-Id: I4861b98e309a32c3c11a40dd0e4675c5ecb846a8
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
index 030ddd2a15..c75a41342d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
@@ -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;
}