ChangeRebuilderImpl: Omit empty group list from update

This allows us to properly convert old patch sets that never had
groups applied. Without this change, we put an empty Groups footer,
which results in the groups list [""] after NoteDb conversion, which
doesn't match the null list prior to conversion. Add a case to
ChangeRebuilderIT to verify.

Change-Id: I2a54c89271965f97fd454b036e78d11229b1a3d7
This commit is contained in:
Dave Borowitz
2016-04-11 16:11:36 -04:00
parent 67b9969228
commit 9e843fa3e1
2 changed files with 26 additions and 1 deletions

View File

@@ -560,7 +560,10 @@ public class ChangeRebuilderImpl extends ChangeRebuilder {
update.setSubjectForCommit("Create patch set " + ps.getPatchSetId());
}
setRevision(update, ps);
update.setGroups(ps.getGroups());
List<String> groups = ps.getGroups();
if (!groups.isEmpty()) {
update.setGroups(ps.getGroups());
}
if (ps.isDraft()) {
update.setPatchSetState(PatchSetState.DRAFT);
}