Change-Id: I343c3065fa369ef8aab2b033ac1e392b28d10daf
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);
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");