diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-04-22 15:46:44 +0900 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2013-04-22 17:17:21 +0000 |
commit | 8dead439f5cdd77dee3df0a2322811045c8561e4 (patch) | |
tree | 1e266b0ff23bb129566f2b9b9d179b0e25b24509 /gerrit-sshd/src | |
parent | a4bc8dfb06e96c871d7c23d0b5e31adf41c95186 (diff) |
Fix: `gerrit review` with --message does not work with no labels
If `gerrit review` is called with the --message option and there
are no review labels given, the message is not added on the change.
This bug was introduced as a side-effect of commit a65b695e, which
intended to prevent the same message being added twice when the
--abandon and --restore options are used.
Commit a65b695e removes the review message if there are no labels,
but this is not quite correct. The message should only be removed
if there are no labels _and_ the --abandon or --restore option is
used.
Update the condition accordingly.
Bug: issue 1874
Change-Id: I062a557b0ea251af826d16cc48a431ea5047ceb1
Diffstat (limited to 'gerrit-sshd/src')
-rw-r--r-- | gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java index 48e175d488..5769a22bdb 100644 --- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java +++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ReviewCommand.java @@ -218,10 +218,8 @@ public class ReviewCommand extends SshCommand { private void applyReview(final ChangeControl ctl, final PatchSet patchSet, final PostReview.Input review) throws Exception { - if (!review.labels.isEmpty()) { - reviewProvider.get().apply(new RevisionResource( - new ChangeResource(ctl), patchSet), review); - } + reviewProvider.get().apply(new RevisionResource( + new ChangeResource(ctl), patchSet), review); } private void approveOne(final PatchSet patchSet) throws Exception { @@ -246,7 +244,7 @@ public class ReviewCommand extends SshCommand { // If review labels are being applied, the comment will be included // on the review note. We don't need to add it again on the abandon // or restore comment. - if (!review.labels.isEmpty()) { + if (!review.labels.isEmpty() && (abandonChange || restoreChange)) { changeComment = null; } |