ChangeNotes: Don't auto-rebuild if both state and ref are missing

This is the normal state when only writing NoteDb changes but not
reading. The whole point of the optimization in Ic8c6c28e was to keep
old changes in this state until an explicit rebuild.

Change-Id: I9353bcd36ead4f4f7350884c795b0bad9c0da572
This commit is contained in:
Dave Borowitz
2016-05-05 17:18:23 -04:00
parent edabbdaa68
commit 31cee3af70
3 changed files with 22 additions and 3 deletions

View File

@@ -153,8 +153,8 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
NoteDbChangeState state = NoteDbChangeState.parse(change);
// Only check if this particular user's drafts are up to date, to avoid
// reading unnecessary refs.
if (state == null
|| !state.areDraftsUpToDate(new RepoRefCache(repo), author)) {
if (!NoteDbChangeState.areDraftsUpToDate(
state, new RepoRefCache(repo), getChangeId(), author)) {
return rebuildAndOpen(repo);
}
}