Merge branch 'stable-2.12'
* stable-2.12: Fix sending of inline comments on commit message for initial change AbstractQueryChangesTest: Add test for query by draft status Fix schema 115: Create a new MetaDataUpdate instance for each update Add the --strict-labels option to SSH review command Allow to add custom core plugins in release build Maven: Split Maven repository settings out to a separate def file Change-Id: I6025858f08214056c288823fe1ce79685800182a
This commit is contained in:
@@ -26,6 +26,7 @@ import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.ObjectReader;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevObject;
|
||||
import org.eclipse.jgit.revwalk.RevTree;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.treewalk.TreeWalk;
|
||||
@@ -56,7 +57,11 @@ public class PatchFile {
|
||||
if (patchList.isAgainstParent()) {
|
||||
a = Text.EMPTY;
|
||||
} else {
|
||||
a = Text.forCommit(reader, patchList.getOldId());
|
||||
// For the initial commit, we have an empty tree on Side A
|
||||
RevObject object = rw.parseAny(patchList.getOldId());
|
||||
a = object instanceof RevCommit
|
||||
? Text.forCommit(reader, object)
|
||||
: Text.EMPTY;
|
||||
}
|
||||
b = Text.forCommit(reader, bCommit);
|
||||
|
||||
|
||||
@@ -286,6 +286,28 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
assertQuery("is:open", expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byStatusDraft() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
ChangeInserter ins1 = newChange(repo, null, null, null, null);
|
||||
Change change1 = ins1.getChange();
|
||||
change1.setStatus(Change.Status.NEW);
|
||||
insert(ins1);
|
||||
ChangeInserter ins2 = newChange(repo, null, null, null, null);
|
||||
Change change2 = ins2.getChange();
|
||||
change2.setStatus(Change.Status.DRAFT);
|
||||
insert(ins2);
|
||||
|
||||
Change[] expected = new Change[] {change2};
|
||||
assertQuery("status:draft", expected);
|
||||
assertQuery("status:DRAFT", expected);
|
||||
assertQuery("status:d", expected);
|
||||
assertQuery("status:dr", expected);
|
||||
assertQuery("status:dra", expected);
|
||||
assertQuery("status:draf", expected);
|
||||
assertQuery("is:draft", expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byStatusClosed() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
|
||||
Reference in New Issue
Block a user