Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refs: document transaction semantics
Add some comments on ref transaction semantics to refs.h

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
David Turner authored and Junio C Hamano committed Feb 25, 2016
1 parent 7548842 commit 4938686
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions refs.h
Expand Up @@ -109,6 +109,11 @@ extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref);
* If this succeeds, the ref updates will have taken place and
* the transaction cannot be rolled back.
*
* - Instead of `ref_transaction_commit`, use
* `initial_ref_transaction_commit()` if the ref database is known
* to be empty (e.g. during clone). This is likely to be much
* faster.
*
* - At any time call `ref_transaction_free()` to discard the
* transaction and free associated resources. In particular,
* this rolls back the transaction if it has not been
Expand All @@ -124,6 +129,13 @@ extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref);
*
* The message is appended to err without first clearing err.
* err will not be '\n' terminated.
*
* Caveats
* -------
*
* Note that no locks are taken, and no refs are read, until
* `ref_transaction_commit` is called. So `ref_transaction_verify`
* won't report a verification failure until the commit is attempted.
*/
struct ref_transaction;

Expand Down

0 comments on commit 4938686

Please sign in to comment.