ReceiveCommits: Fix NPE when pushing to refs/changes/n
Change-Id: Iccf24e5262dcfe8e0fde0b63e1ef5411d7266592
This commit is contained in:
parent
ebab92aabd
commit
7ee9dc17b4
@ -201,6 +201,18 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
assertThat(cr.all.get(0).value.intValue()).is(2);
|
assertThat(cr.all.get(0).value.intValue()).is(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPushNewPatchsetToRefsChanges() throws GitAPIException,
|
||||||
|
IOException, OrmException {
|
||||||
|
PushOneCommit.Result r = pushTo("refs/for/master");
|
||||||
|
r.assertOkStatus();
|
||||||
|
PushOneCommit push =
|
||||||
|
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT,
|
||||||
|
"b.txt", "anotherContent", r.getChangeId());
|
||||||
|
r = push.to(git, "refs/changes/" + r.getChange().change().getId().get());
|
||||||
|
r.assertOkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPushForMasterWithApprovals_MissingLabel() throws GitAPIException,
|
public void testPushForMasterWithApprovals_MissingLabel() throws GitAPIException,
|
||||||
IOException {
|
IOException {
|
||||||
|
@ -2041,7 +2041,7 @@ public class ReceiveCommits {
|
|||||||
@Override
|
@Override
|
||||||
public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException {
|
public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException {
|
||||||
try {
|
try {
|
||||||
if (magicBranch.edit) {
|
if (magicBranch != null && magicBranch.edit) {
|
||||||
return upsertEdit();
|
return upsertEdit();
|
||||||
} else if (caller == Thread.currentThread()) {
|
} else if (caller == Thread.currentThread()) {
|
||||||
return insertPatchSet(db);
|
return insertPatchSet(db);
|
||||||
|
Loading…
Reference in New Issue
Block a user