Merge "Configuration option change.showAssignee"
diff --git a/ReleaseNotes/ReleaseNotes-2.12.5.txt b/ReleaseNotes/ReleaseNotes-2.12.5.txt
new file mode 100644
index 0000000..12d6870
--- /dev/null
+++ b/ReleaseNotes/ReleaseNotes-2.12.5.txt
@@ -0,0 +1,101 @@
+= Release notes for Gerrit 2.12.5
+
+Gerrit 2.12.5 is now available:
+
+link:https://gerrit-releases.storage.googleapis.com/gerrit-2.12.5.war[
+https://gerrit-releases.storage.googleapis.com/gerrit-2.12.5.war]
+
+== Schema Upgrade
+
+*WARNING:* There are no schema changes from link:ReleaseNotes-2.12.4.html[
+2.12.4] but a manual schema upgrade is necessary when upgrading from 2.12.
+
+When upgrading a site that is already running version 2.12, the `patch_sets`
+table must be manually migrated using the `gerrit gsql` SSH command or the
+`gqsl` site program.
+
+For the default H2 database, execute the command:
+
+----
+  alter table patch_sets modify push_certficate clob;
+----
+
+For MySQL, execute the command:
+
+----
+  alter table patch_sets modify push_certficate text;
+----
+
+For PostgreSQL, execute the command:
+
+----
+  alter table patch_sets alter column push_certficate type text;
+----
+
+For other database types, execute the appropriate equivalent command.
+
+Note that the misspelled `push_certficate` is the actual name of the
+column.
+
+When upgrading from a version earlier than 2.12, or from 2.12.1 or 2.12.2
+having already done the migration, this manual step is not necessary and
+should be omitted.
+
+== Known Issues
+
+* link:https://bugs.chromium.org/p/gerrit/issues/detail?id=4323[Issue 4323]:
+'value too long for type character varying(255)' in patch_sets table when
+migrating to schema version 108.
++
+This error may occur under some circumstances when running the schema
+migration from an earlier version of Gerrit.
++
+On sites where this occurs, it can be fixed with a manual schema update
+according to the comments in the issue.
+
+== New Features
+
+* New preference to enable line wrapping in diff screen and inline editor.
+
+== Bug Fixes
+
+* Fix the diff and edit preference dialogs for smaller screens.
++
+On smaller screens the options at the bottom of the dialogs would
+get cut off, making it difficult to change them.
+
+* link:https://bugs.chromium.org/p/gerrit/issues/detail?id=4521[Issue 4521]:
+Fix internal server error during validation of email addresses.
++
+When creating a new account or adding a new email address to an existing
+account, the email validation crashed.
+
+* Lucene stability improvements.
++
+Each Lucene index is now written using a dedicated background thread. Lucene
+threads may not be cancelled, to prevent interruptions while writing.
+
+* Don't try to change username that is already set.
++
+Since Gerrit version 2.1.4 it is not allowed to change the username once
+it has been set, and attempting to do so results in an exception.
++
+If `ldap.accountSshUserName` is set in the `gerrit.config` using
+`${userPrincipalName.localPart}` to initialize the username from the user's
+email address, and then the email address is changed, the username gets
+resolved to something different and the account manager tried to change it.
+As a result, an exception was raised and the user could no longer log in.
++
+Instead of trying to change the username, a warning is logged.
+
+* link:https://bugs.chromium.org/p/gerrit/issues/detail?id=4006[Issue 4006]:
+Prevent search limit parameter from exceeding maximum integer value.
+
+* Fix internal server error when generating task names.
+
+* Print proper names for query tasks in the output of the `show-queue` command.
+
+* Double-check change status when auto-abandoning changes.
++
+It was possible that changes could be updated in the time between the query
+results being returned and the change being abandoned.
diff --git a/ReleaseNotes/index.txt b/ReleaseNotes/index.txt
index 3ba24c5..0fc495f 100644
--- a/ReleaseNotes/index.txt
+++ b/ReleaseNotes/index.txt
@@ -6,6 +6,7 @@
 
 [[s2_12]]
 == Version 2.12.x
+* link:ReleaseNotes-2.12.5.html[2.12.5]
 * link:ReleaseNotes-2.12.4.html[2.12.4]
 * link:ReleaseNotes-2.12.3.html[2.12.3]
 * link:ReleaseNotes-2.12.2.html[2.12.2]
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/DeleteAssignee.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/DeleteAssignee.java
index 0c5b721..fe2ba6f 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/DeleteAssignee.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/DeleteAssignee.java
@@ -103,7 +103,7 @@
         return false;
       }
       Account account = accountInfos.create().get(currentAssigneeId.get());
-      update.setAssignee(Optional.absent());
+      update.removeAssignee();
       addMessage(ctx, update, account);
       deletedAssignee = account;
       return true;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/SetAssigneeOp.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/SetAssigneeOp.java
index f6f9ee0..b75463d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/SetAssigneeOp.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/SetAssigneeOp.java
@@ -101,7 +101,7 @@
           ctx.getChange().getChangeId(),
           newAssigneeUser.getUserName()));
     }
-    update.setAssignee(Optional.fromNullable(newAssigneeUser.getAccountId()));
+    update.setAssignee(newAssigneeUser.getAccountId());
     this.newAssignee = newAssigneeUser.getAccount();
     addMessage(ctx, update, oldAssignee);
     return true;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeUpdate.java b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeUpdate.java
index 6e95348..263edab 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeUpdate.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeUpdate.java
@@ -378,8 +378,13 @@
     this.hashtags = hashtags;
   }
 
-  public void setAssignee(Optional<Account.Id> assignee) {
-    this.assignee = assignee;
+  public void setAssignee(Account.Id assignee) {
+    checkArgument(assignee != null, "use removeAssignee");
+    this.assignee = Optional.of(assignee);
+  }
+
+  public void removeAssignee() {
+    this.assignee = Optional.absent();
   }
 
   public Map<Account.Id, ReviewerStateInternal> getReviewers() {
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java
index 7127766..e31e096 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java
@@ -24,7 +24,6 @@
 import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
 import static org.junit.Assert.fail;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableListMultimap;
@@ -566,7 +565,7 @@
   public void assigneeCommit() throws Exception {
     Change c = newChange();
     ChangeUpdate update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.fromNullable(otherUserId));
+    update.setAssignee(otherUserId);
     ObjectId result = update.commit();
     assertThat(result).isNotNull();
     try (RevWalk rw = new RevWalk(repo)) {
@@ -588,14 +587,14 @@
   public void assigneeChangeNotes() throws Exception {
     Change c = newChange();
     ChangeUpdate update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.fromNullable(otherUserId));
+    update.setAssignee(otherUserId);
     update.commit();
 
     ChangeNotes notes = newNotes(c);
     assertThat(notes.getAssignee().get()).isEqualTo(otherUserId);
 
     update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.fromNullable(changeOwner.getAccountId()));
+    update.setAssignee(changeOwner.getAccountId());
     update.commit();
 
     notes = newNotes(c);
@@ -606,21 +605,21 @@
   public void pastAssigneesChangeNotes() throws Exception {
     Change c = newChange();
     ChangeUpdate update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.fromNullable(otherUserId));
+    update.setAssignee(otherUserId);
     update.commit();
 
     ChangeNotes notes = newNotes(c);
 
     update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.fromNullable(changeOwner.getAccountId()));
+    update.setAssignee(changeOwner.getAccountId());
     update.commit();
 
     update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.fromNullable(otherUserId));
+    update.setAssignee(otherUserId);
     update.commit();
 
     update = newUpdate(c, changeOwner);
-    update.setAssignee(Optional.absent());
+    update.removeAssignee();
     update.commit();
 
     notes = newNotes(c);
diff --git a/plugins/cookbook-plugin b/plugins/cookbook-plugin
index 23572e6..288f50d 160000
--- a/plugins/cookbook-plugin
+++ b/plugins/cookbook-plugin
@@ -1 +1 @@
-Subproject commit 23572e6c83531fceea69c1356a5e1b6753ecf0e3
+Subproject commit 288f50d28ab8b141efad4297125dcc145d62f0ec