int tz = -4 * 60;
// check that there are no entries in the reflog and turn off writing
// reflogs
assertEquals(0, db.getReflogReader(Constants.HEAD).getReverseEntries().size());
final FileBasedConfig cfg = db.getConfig();
cfg.setBoolean("core", null, "logallrefupdates", false);
cfg.save();
// do one commit and check that reflog size is 0: no reflogs should be
// written
commit("A Commit\n", new PersonIdent(author, commitTime, tz),
new PersonIdent(committer, commitTime, tz));
commitTime += 60 * 1000;
assertTrue(
"Reflog for HEAD still contain no entry",
db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 0);
// set the logAllRefUpdates parameter to true and check it
cfg.setBoolean("core", null, "logallrefupdates", true);
cfg.save();
assertTrue(cfg.get(CoreConfig.KEY).isLogAllRefUpdates());
// do one commit and check that reflog size is increased to 1
commit("A Commit\n", new PersonIdent(author, commitTime, tz),
new PersonIdent(committer, commitTime, tz));
commitTime += 60 * 1000;
assertTrue(
"Reflog for HEAD should contain one entry",
db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 1);
// set the logAllRefUpdates parameter to false and check it
cfg.setBoolean("core", null, "logallrefupdates", false);
cfg.save();
assertFalse(cfg.get(CoreConfig.KEY).isLogAllRefUpdates());
// do one commit and check that reflog size is 2
commit("A Commit\n", new PersonIdent(author, commitTime, tz),
new PersonIdent(committer, commitTime, tz));
assertTrue(