git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] refs: document transaction semantics

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2016, 20:34 UTC
Message-ID
<xmqqvb5cmsup.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1456431013.18017.50.camel@twopensource.com>
David Turner <dturner@twopensource.com> writes:
> I thought it would be better in the api docs, since it's a design
> decision that all backends should follow.

Makes sense; as this describes an already available API, it shouldn't have to wait for the remainder of your series and can just go to 'master' (or even to 'maint' if we wanted to), right?

Show 41 quoted lines
> On Thu, 2016-02-25 at 15:05 -0500, David Turner wrote:
>> Add some comments on ref transaction semantics to refs.h
>> 
>> Signed-off-by: David Turner <dturner@twopensource.com>
>> ---
>>  refs.h | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>> 
>> diff --git a/refs.h b/refs.h
>> index c0964f5..9b3eaf3 100644
>> --- a/refs.h
>> +++ b/refs.h
>> @@ -112,6 +112,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
>> @@ -127,6 +132,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;
>>  
Previous: David TurnerNext: David Turner
Message 49 of 52 in “refs backends”
  1. 00/27 refs backendsDavid Turner, Feb 18, 2016
  2. 01/27 refs: Move head_ref{,_submodule} to the common codeDavid Turner, Feb 18, 2016
  3. 02/27 refs: move for_each_*ref* functions into common codeDavid Turner, Feb 18, 2016
  4. 03/27 refs: add a backend method structure with transaction functionsDavid Turner, Feb 18, 2016
  5. 04/27 refs: add methods for misc ref operationsDavid Turner, Feb 18, 2016
  6. 05/27 refs: add method for do_for_each_refDavid Turner, Feb 18, 2016
  7. 06/27 refs: add do_for_each_per_worktree_refDavid Turner, Feb 18, 2016
  8. 07/27 refs: add methods for reflogDavid Turner, Feb 18, 2016
  9. 08/27 refs: add method for initial ref transaction commitDavid Turner, Feb 18, 2016
  10. 09/27 refs: add method for delete_refsDavid Turner, Feb 18, 2016
  11. 10/27 refs: add methods to init refs dbDavid Turner, Feb 18, 2016
  12. 11/27 refs: add method to rename refsDavid Turner, Feb 18, 2016
  13. 12/27 refs: forbid cross-backend ref renamesDavid Turner, Feb 18, 2016
  14. Duy NguyenFeb 20, 2016
  15. David TurnerFeb 24, 2016
  16. 13/27 refs: make lock genericDavid Turner, Feb 18, 2016
  17. 14/27 refs: move duplicate check to common codeDavid Turner, Feb 18, 2016
  18. 15/27 refs: allow log-only updatesDavid Turner, Feb 18, 2016
  19. 16/27 refs: don't dereference on renameDavid Turner, Feb 18, 2016
  20. 17/27 refs: on symref reflog expire, lock symref not referrentDavid Turner, Feb 18, 2016
  21. 18/27 refs: resolve symbolic refs firstDavid Turner, Feb 18, 2016
  22. 19/27 refs: always handle non-normal refs in files backendDavid Turner, Feb 18, 2016
  23. 20/27 init: allow alternate ref strorage to be set for new reposDavid Turner, Feb 18, 2016
  24. 21/27 refs: check submodules' ref storage configDavid Turner, Feb 18, 2016
  25. 22/27 clone: allow ref storage backend to be set for cloneDavid Turner, Feb 18, 2016
  26. 23/27 svn: learn ref-storage argumentDavid Turner, Feb 18, 2016
  27. Eric WongFeb 20, 2016
  28. David TurnerFeb 23, 2016
  29. 24/27 refs: add register_ref_storage_backends()David Turner, Feb 18, 2016
  30. 25/27 refs: add LMDB refs storage backendDavid Turner, Feb 18, 2016
  31. Duy NguyenFeb 18, 2016
  32. David TurnerFeb 18, 2016
  33. Junio C HamanoFeb 18, 2016
  34. Duy NguyenFeb 19, 2016
  35. David TurnerFeb 19, 2016
  36. Duy NguyenFeb 20, 2016
  37. David TurnerFeb 24, 2016
  38. Junio C HamanoFeb 20, 2016
  39. David TurnerFeb 19, 2016
  40. Junio C HamanoFeb 19, 2016
  41. Duy NguyenFeb 20, 2016
  42. David TurnerFeb 24, 2016
  43. Duy NguyenFeb 25, 2016
  44. Duy NguyenFeb 20, 2016
  45. David TurnerFeb 24, 2016
  46. Duy NguyenFeb 25, 2016
  47. refs: document transaction semanticsDavid Turner, Feb 25, 2016
  48. David TurnerFeb 25, 2016
  49. Junio C HamanoFeb 25, 2016
  50. David TurnerFeb 25, 2016
  51. 26/27 refs: tests for lmdb backendDavid Turner, Feb 18, 2016
  52. 27/27 tests: add ref-storage argumentDavid Turner, Feb 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.