InlineEdit: Trigger reindexing on git push
When pushing with magic branch %edit option, there was no operation added and as a consequence no reindexing took place, which lead to non working has:edit predicate. To rectify, add dummy change edit mutation operation, that sets pseudo dirty flag to trigger the reindexing. Update tests correspondingly to verify that after the git push to refs/for/master%edit the index is aware of the edit. Reported-By: Alice Kober-Sotzek <aliceks@google.com> Bug: Issue 5350 Change-Id: I4f366bcbb9d2aa45c288c636b1ba2c3e485f8fb4
This commit is contained in:
committed by
David Pursehouse
parent
646db67977
commit
3cb7c81a68
@@ -406,6 +406,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
r.assertOkStatus();
|
r.assertOkStatus();
|
||||||
Optional<EditInfo> edit = getEdit(r.getChangeId());
|
Optional<EditInfo> edit = getEdit(r.getChangeId());
|
||||||
assertThat(edit).isAbsent();
|
assertThat(edit).isAbsent();
|
||||||
|
assertThat(query("has:edit")).isEmpty();
|
||||||
|
|
||||||
// specify edit as option
|
// specify edit as option
|
||||||
r = amendChange(r.getChangeId(), "refs/for/master%edit");
|
r = amendChange(r.getChangeId(), "refs/for/master%edit");
|
||||||
@@ -420,6 +421,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
+ " "
|
+ " "
|
||||||
+ editInfo.commit.subject
|
+ editInfo.commit.subject
|
||||||
+ " [EDIT]\n");
|
+ " [EDIT]\n");
|
||||||
|
|
||||||
|
// verify that the re-indexing was triggered for the change
|
||||||
|
assertThat(query("has:edit")).hasSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -2500,6 +2500,15 @@ public class ReceiveCommits {
|
|||||||
cmd.execute(rp);
|
cmd.execute(rp);
|
||||||
}
|
}
|
||||||
if (magicBranch != null && magicBranch.edit) {
|
if (magicBranch != null && magicBranch.edit) {
|
||||||
|
bu.addOp(
|
||||||
|
notes.getChangeId(),
|
||||||
|
new BatchUpdate.Op() {
|
||||||
|
@Override
|
||||||
|
public boolean updateChange(ChangeContext ctx) throws Exception {
|
||||||
|
// return pseudo dirty state to trigger reindexing
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RevWalk rw = rp.getRevWalk();
|
RevWalk rw = rp.getRevWalk();
|
||||||
|
|||||||
Reference in New Issue
Block a user