function commit()
{
if ($this->txFp === false) {
throw new LogicException('transaction is not active');
}
$ex = null;
try {
$did_write = $this->txWriteData();
} catch (Exception $e) {
$ex = $e;
}
$this->txEnd($ex);
if ($ex) {
throw $ex;
}
# commit to repo
if ($did_write && $this->autocommitToRepo) {
gb::log('committing changes to ' . $this->file);
if (!($author = $this->autocommitToRepoAuthor)) {
$author = GBUser::findAdmin()->gitAuthor();
}
$m = $this->autocommitToRepoMessage ? $this->autocommitToRepoMessage : 'autocommit:' . $this->file;
git::add($this->file);
git::commit($m, $author);
# rollback() will handle gb::reset if needed
}
return $did_write;
}