Fixed
Status Update
Comments
ek...@google.com <ek...@google.com> #2
[Monorail components: Backend]
am...@wikimedia.org <am...@wikimedia.org> #3
I can reproduce on Gerrit 3.5.4 when sending an empty patchset:
git commit --allow-empty -m 'I am an empty patch'
It is marked with kind: REWORK. Fromhttps://bugs.chromium.org/p/gerrit/issues/detail?id=15613 that also happened with 3.4?
git commit --allow-empty -m 'I am an empty patch'
It is marked with kind: REWORK. From
na...@linaro.org <na...@linaro.org>
ap...@google.com <ap...@google.com> #4
Project: gerrit
Branch: stable-3.9
commit e48a495f9d4da5fcd49f10ce756538c19e0deeec
Author: Nasser Grainawi <nasser.grainawi@linaro.org>
Date: Thu Dec 07 15:14:44 2023
Stop considering WIP changes "unmergeable"
While work-in-progress changes are unsubmittable, they can be
mergeable. This is important if a site has set
change.mergeabilityComputationBehavior to a value other than NEVER.
Without this change, WIP changes always show as having a merge conflict
when viewed as search/query results. A new test is added for that
behavior and it fails prior to this change.
Bug: Issue 40014889
Change-Id: I8ae13f6563fd7a527b1af92ba1533433949b61f9
Release-Notes: Fixed WIP changes always showing Merge Conflict in searches
M java/com/google/gerrit/server/query/change/ChangeData.java
M javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
https://gerrit-review.googlesource.com/396899
Branch: stable-3.9
commit e48a495f9d4da5fcd49f10ce756538c19e0deeec
Author: Nasser Grainawi <nasser.grainawi@linaro.org>
Date: Thu Dec 07 15:14:44 2023
Stop considering WIP changes "unmergeable"
While work-in-progress changes are unsubmittable, they can be
mergeable. This is important if a site has set
change.mergeabilityComputationBehavior to a value other than NEVER.
Without this change, WIP changes always show as having a merge conflict
when viewed as search/query results. A new test is added for that
behavior and it fails prior to this change.
Bug:
Change-Id: I8ae13f6563fd7a527b1af92ba1533433949b61f9
Release-Notes: Fixed WIP changes always showing Merge Conflict in searches
M java/com/google/gerrit/server/query/change/ChangeData.java
M javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
ap...@google.com <ap...@google.com> #5
Project: gerrit
Branch: stable-3.7
commit 3f071d6f42c1b1bd0f391b5f8542f981d76e15eb
Author: Nasser Grainawi <nasser.grainawi@linaro.org>
Date: Thu Dec 07 15:14:44 2023
Stop considering WIP changes "unmergeable"
While work-in-progress changes are unsubmittable, they can be
mergeable. This is important if a site has set
change.mergeabilityComputationBehavior to a value other than NEVER.
Without this change, WIP changes always show as having a merge conflict
when viewed as search/query results. A new test is added for that
behavior and it fails prior to this change.
Bug: Issue 40014889
Change-Id: I8ae13f6563fd7a527b1af92ba1533433949b61f9
Release-Notes: Fixed WIP changes always showing Merge Conflict in searches
(cherry picked from commit e48a495f9d4da5fcd49f10ce756538c19e0deeec)
M java/com/google/gerrit/server/query/change/ChangeData.java
M javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
https://gerrit-review.googlesource.com/417158
Branch: stable-3.7
commit 3f071d6f42c1b1bd0f391b5f8542f981d76e15eb
Author: Nasser Grainawi <nasser.grainawi@linaro.org>
Date: Thu Dec 07 15:14:44 2023
Stop considering WIP changes "unmergeable"
While work-in-progress changes are unsubmittable, they can be
mergeable. This is important if a site has set
change.mergeabilityComputationBehavior to a value other than NEVER.
Without this change, WIP changes always show as having a merge conflict
when viewed as search/query results. A new test is added for that
behavior and it fails prior to this change.
Bug:
Change-Id: I8ae13f6563fd7a527b1af92ba1533433949b61f9
Release-Notes: Fixed WIP changes always showing Merge Conflict in searches
(cherry picked from commit e48a495f9d4da5fcd49f10ce756538c19e0deeec)
M java/com/google/gerrit/server/query/change/ChangeData.java
M javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
Description
*************************************************************************
*** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!
*** Do not submit bugs for chrome/android and issues with your company's
*** Gerrit setup here. Those issues belong in different issue trackers.
*************************************************************************
What steps will reproduce the problem?
1. Mark a change work in progress
2. Search for that change or search for all wip changes with 'is:wip'
3. Notice that the WIP change is unconditionally marked as Merge Conflicted in the listing
What is the expected output?
The change should only be marked as merge conflict if there is an actual merge conflict.
What do you see instead?
All WIP changes are marked merge conflict.
Please provide any additional information below.
We see this behavior running Gerrit 3.5.2-35-g04be0ba23b-dirty with change.mergeabilityComputationBehavior = API_REF_UPDATED_AND_CHANGE_REINDEX set. I am not sure if we had this same problem under 3.4 as well.
Digging into rest API responses and the code a bit I think I see why this is happening but don't yet understand the root cause. It seems that every wip change's json data has mergeable:false and work_in_progress:true set. Thenhttps://gerrit.googlesource.com/gerrit/+/refs/tags/v3.5.2/polygerrit-ui/app/utils/change-util.ts#160 is able to set both merge conflict and wip statuses as they are not part of the same if else if block but are checked separately. This code doesn't appear to have been updated recently.
I suspect the problem is that mergeable:false should be mergeable:null. This is based on isMergeable's behavior here:https://gerrit.googlesource.com/gerrit/+/refs/tags/v3.5.2/java/com/google/gerrit/server/query/change/ChangeData.java#1050 . In that location we check if mergeable is null then we check if the change is a work in progress, if so we return null.
That implies mergeable is already true when calling isMergeable here:https://gerrit.googlesource.com/gerrit/+/refs/tags/v3.5.2/java/com/google/gerrit/server/change/ChangeJson.java#623 . It seems the only location we call setMergeable with a non null value is : https://gerrit.googlesource.com/gerrit/+/refs/tags/v3.5.2/java/com/google/gerrit/server/index/change/ChangeField.java#802 . Should this index query be updated to check if the change is a wip before setting the value? Or perhaps we should check if a work in progress in isMergeable and short circuit with null there?
I'm not entirely sure how this is all tied together yet so neither approach may be appropriate.