NoteDb: Fix conversion of PatchSet.pushCertificate field
RevisionNote was excluding the trailing newline from the push cert parsed out of the note, even though it was present in NoteDb. Include the newline so they match. However, this diff is spurious anyway-- OpenPGP parsers don't care whether there are trailing newlines. So harden ChangeBundle against trailing newlines not matching as well. Change-Id: Idc85ab226040ab2e507cf7a83c0b4cd5286ffb58
This commit is contained in:
@@ -358,6 +358,43 @@ public class ChangeRebuilderIT extends AbstractDaemonTest {
|
||||
assertDraftsUpToDate(true, id, user);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pushCert() throws Exception {
|
||||
// We don't have the code in our test harness to do signed pushes, so just
|
||||
// use a hard-coded cert. This cert was actually generated by C git 2.2.0
|
||||
// (albeit not for sending to Gerrit).
|
||||
String cert = "certificate version 0.1\n"
|
||||
+ "pusher Dave Borowitz <dborowitz@google.com> 1433954361 -0700\n"
|
||||
+ "pushee git://localhost/repo.git\n"
|
||||
+ "nonce 1433954361-bde756572d665bba81d8\n"
|
||||
+ "\n"
|
||||
+ "0000000000000000000000000000000000000000"
|
||||
+ "b981a177396fb47345b7df3e4d3f854c6bea7"
|
||||
+ "s/heads/master\n"
|
||||
+ "-----BEGIN PGP SIGNATURE-----\n"
|
||||
+ "Version: GnuPG v1\n"
|
||||
+ "\n"
|
||||
+ "iQEcBAABAgAGBQJVeGg5AAoJEPfTicJkUdPkUggH/RKAeI9/i/LduuiqrL/SSdIa\n"
|
||||
+ "9tYaSqJKLbXz63M/AW4Sp+4u+dVCQvnAt/a35CVEnpZz6hN4Kn/tiswOWVJf4CO7\n"
|
||||
+ "htNubGs5ZMwvD6sLYqKAnrM3WxV/2TbbjzjZW6Jkidz3jz/WRT4SmjGYiEO7aA+V\n"
|
||||
+ "4ZdIS9f7sW5VsHHYlNThCA7vH8Uu48bUovFXyQlPTX0pToSgrWV3JnTxDNxfn3iG\n"
|
||||
+ "IL0zTY/qwVCdXgFownLcs6J050xrrBWIKqfcWr3u4D2aCLyR0v+S/KArr7ulZygY\n"
|
||||
+ "+SOklImn8TAZiNxhWtA6ens66IiammUkZYFv7SSzoPLFZT4dC84SmGPWgf94NoQ=\n"
|
||||
+ "=XFeC\n"
|
||||
+ "-----END PGP SIGNATURE-----\n";
|
||||
|
||||
PushOneCommit.Result r = createChange();
|
||||
PatchSet.Id psId = r.getPatchSetId();
|
||||
Change.Id id = psId.getParentKey();
|
||||
|
||||
PatchSet ps = db.patchSets().get(psId);
|
||||
ps.setPushCertificate(cert);
|
||||
db.patchSets().update(Collections.singleton(ps));
|
||||
indexer.index(db, project, id);
|
||||
|
||||
checker.rebuildAndCheckChanges(id);
|
||||
}
|
||||
|
||||
private void setInvalidNoteDbState(Change.Id id) throws Exception {
|
||||
ReviewDb db = unwrapDb();
|
||||
Change c = db.changes().get(id);
|
||||
|
||||
Reference in New Issue
Block a user