Browse Source

TestRepository: Ignore existing Change-Id in message

Change-Id: I343c3065fa369ef8aab2b033ac1e392b28d10daf
stable-4.0
Dave Borowitz 10 years ago
parent
commit
6ed07f5cb5
  1. 4
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
  2. 10
      org.eclipse.jgit.test/tst/org/eclipse/jgit/junit/TestRepositoryTest.java

4
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java

@ -1045,6 +1045,10 @@ public class TestRepository<R extends Repository> {
private void insertChangeId(org.eclipse.jgit.lib.CommitBuilder c)
throws IOException {
int idx = ChangeIdUtil.indexOfChangeId(message, "\n");
if (idx >= 0)
return;
ObjectId firstParentId = null;
if (!parents.isEmpty())
firstParentId = parents.get(0);

10
org.eclipse.jgit.test/tst/org/eclipse/jgit/junit/TestRepositoryTest.java

@ -102,6 +102,16 @@ public class TestRepositoryTest {
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
public void resetFromSymref() throws Exception {
repo.updateRef("HEAD").link("refs/heads/master");

Loading…
Cancel
Save