Merge "Fix ArrayIndexOutOfBoundsException on initial commits" into stable-2.8

This commit is contained in:
Shawn Pearce
2013-12-10 03:12:28 +00:00
committed by Gerrit Code Review

View File

@@ -370,8 +370,7 @@ public class PatchSetInserter {
public static ChangeKind getChangeKind(MergeUtil.Factory mergeUtilFactory, ProjectState project,
Repository git, RevCommit prior, RevCommit next) {
if (!next.getFullMessage().equals(prior.getFullMessage())) {
if (next.getTree() == prior.getTree()
&& prior.getParent(0).equals(next.getParent(0))) {
if (next.getTree() == prior.getTree() && isSameParents(prior, next)) {
return ChangeKind.NO_CODE_CHANGE;
} else {
return ChangeKind.REWORK;
@@ -384,7 +383,7 @@ public class PatchSetInserter {
}
if (next.getTree() == prior.getTree() &&
prior.getParent(0).equals(next.getParent(0))) {
isSameParents(prior, next)) {
return ChangeKind.TRIVIAL_REBASE;
}
@@ -409,6 +408,15 @@ public class PatchSetInserter {
}
}
private static boolean isSameParents(RevCommit prior, RevCommit next) {
if (prior.getParentCount() != next.getParentCount()) {
return false;
} else if (prior.getParentCount() == 0) {
return true;
}
return prior.getParent(0).equals(next.getParent(0));
}
public class ChangeModifiedException extends InvalidChangeOperationException {
private static final long serialVersionUID = 1L;