TestRepository: Ignore existing Change-Id in message
Change-Id: I343c3065fa369ef8aab2b033ac1e392b28d10daf
This commit is contained in:
parent
0b625445ef
commit
6ed07f5cb5
|
@ -1045,6 +1045,10 @@ public RevCommit create() throws Exception {
|
||||||
|
|
||||||
private void insertChangeId(org.eclipse.jgit.lib.CommitBuilder c)
|
private void insertChangeId(org.eclipse.jgit.lib.CommitBuilder c)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
int idx = ChangeIdUtil.indexOfChangeId(message, "\n");
|
||||||
|
if (idx >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
ObjectId firstParentId = null;
|
ObjectId firstParentId = null;
|
||||||
if (!parents.isEmpty())
|
if (!parents.isEmpty())
|
||||||
firstParentId = parents.get(0);
|
firstParentId = parents.get(0);
|
||||||
|
|
|
@ -102,6 +102,16 @@ public void insertChangeId() throws Exception {
|
||||||
c2.getFullMessage());
|
c2.getFullMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void insertChangeIdIgnoresExisting() throws Exception {
|
||||||
|
String msg = "message\n"
|
||||||
|
+ "\n"
|
||||||
|
+ "Change-Id: Ideadbeefdeadbeefdeadbeefdeadbeefdeadbeef\n";
|
||||||
|
RevCommit c = tr.commit().message(msg).insertChangeId().create();
|
||||||
|
rw.parseBody(c);
|
||||||
|
assertEquals(msg, c.getFullMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resetFromSymref() throws Exception {
|
public void resetFromSymref() throws Exception {
|
||||||
repo.updateRef("HEAD").link("refs/heads/master");
|
repo.updateRef("HEAD").link("refs/heads/master");
|
||||||
|
|
Loading…
Reference in New Issue