Fix write_revision hook