summaryrefslogtreecommitdiff
path: root/subversion/libsvn_repos/fs-wrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_repos/fs-wrap.c')
-rw-r--r--subversion/libsvn_repos/fs-wrap.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/subversion/libsvn_repos/fs-wrap.c b/subversion/libsvn_repos/fs-wrap.c
index 755fa61bbb053..006b2861eb063 100644
--- a/subversion/libsvn_repos/fs-wrap.c
+++ b/subversion/libsvn_repos/fs-wrap.c
@@ -117,6 +117,8 @@ svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
const char *txn_name;
svn_string_t *author = svn_hash_gets(revprop_table, SVN_PROP_REVISION_AUTHOR);
apr_hash_t *hooks_env;
+ svn_error_t *err;
+ svn_fs_txn_t *txn;
/* Parse the hooks-env file (if any). */
SVN_ERR(svn_repos__parse_hooks_env(&hooks_env, repos->hooks_env_path,
@@ -124,21 +126,30 @@ svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
/* Begin the transaction, ask for the fs to do on-the-fly lock checks.
We fetch its name, too, so the start-commit hook can use it. */
- SVN_ERR(svn_fs_begin_txn2(txn_p, repos->fs, rev,
+ SVN_ERR(svn_fs_begin_txn2(&txn, repos->fs, rev,
SVN_FS_TXN_CHECK_LOCKS, pool));
- SVN_ERR(svn_fs_txn_name(&txn_name, *txn_p, pool));
+ err = svn_fs_txn_name(&txn_name, txn, pool);
+ if (err)
+ return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool));
/* We pass the revision properties to the filesystem by adding them
as properties on the txn. Later, when we commit the txn, these
properties will be copied into the newly created revision. */
revprops = svn_prop_hash_to_array(revprop_table, pool);
- SVN_ERR(svn_repos_fs_change_txn_props(*txn_p, revprops, pool));
+ err = svn_repos_fs_change_txn_props(txn, revprops, pool);
+ if (err)
+ return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool));
/* Run start-commit hooks. */
- SVN_ERR(svn_repos__hooks_start_commit(repos, hooks_env,
- author ? author->data : NULL,
- repos->client_capabilities, txn_name,
- pool));
+ err = svn_repos__hooks_start_commit(repos, hooks_env,
+ author ? author->data : NULL,
+ repos->client_capabilities, txn_name,
+ pool);
+ if (err)
+ return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool));
+
+ /* We have API promise that *TXN_P is unaffected on faulure. */
+ *txn_p = txn;
return SVN_NO_ERROR;
}