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

Re: [PATCH v4 7/8] update-ref: support multiple simultaneous updates

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2013, 21:23 UTC
Message-ID
<xmqqk3ivgdxz.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5228EA62.7030606@kitware.com>
Brad King <brad.king@kitware.com> writes:
Show 26 quoted lines
> On 09/04/2013 05:27 PM, Junio C Hamano wrote:
>> I am not saying the above is the best format, but the point is that
>> the mode of the operation defines the structure
>
> Great, thanks for your comments.  Based on that I've prototyped a
> new format.  Rather than jumping straight to the patch, here is my
> proposed format documentation for review:
>
> -------------------------------------------------------------------------
> With `--stdin`, update-ref reads instructions from standard input and
> performs all modifications together.  Specify commands of the form:
>
> 	create SP <ref> SP <newvalue> LF
> 	update SP <ref> SP <newvalue> [SP <oldvalue>] LF
> 	delete SP <ref> [SP <oldvalue>] LF
> 	verify SP <ref> [SP <oldvalue>] LF
> 	option SP <opt> LF
>
> Quote fields containing whitespace as if they were strings in C source
> code.  Alternatively, use `-z` to specify commands without quoting:
>
> 	create SP <ref> NUL <newvalue> NUL
> 	update SP <ref> NUL <newvalue> NUL [<oldvalue>] NUL
> 	delete SP <ref> NUL [<oldvalue>] NUL
> 	verify SP <ref> NUL [<oldvalue>] NUL
> 	option SP <opt> NUL

That SP in '-z' format looks strange. Was there a reason why NUL was inappropriate?

Show 22 quoted lines
> Lines of any other format or a repeated <ref> produce an error.
> Command meanings are:
>
> create::
> 	Create <ref> with <newvalue> only if it does not exist.
>
> update::
> 	Update <ref> to be <newvalue>, verifying <oldvalue> if given.
> 	Specify a zero <newvalue> to delete a ref and/or a zero
> 	<oldvalue> to make sure that a ref does not exist.
>
> delete::
> 	Delete <ref>, verifying <oldvalue> if given.
>
> verify::
> 	Verify <ref> against <oldvalue> but do not change it.  If
> 	<oldvalue> zero or missing, the ref must not exist.
>
> option::
> 	Specify an option to take effect for following commands.
> 	Valid options are `deref` and `no-deref` to specify whether
> 	to dereference symbolic refs.

This last one is somewhat peculiar, especially because it says "following command*s*".

How would I request to update refs HEAD and next in an all-or-none fashion, while applying 'no-deref' only to HEAD but not next?

	update refs/heads/next <newvalue>
	option --no-deref
        update HEAD <newvalue>
sounds somewhat convoluted.

When I said "create or update" in the message you are responding to, I did not mean that we should have two separate commands. The regular command line does create-or-update; if it exists already, it is an update, and if it does not, it is a create.

If we were to have two, I would say we should have:
	create-or-update <ref> <newvalue> [<oldvalue>]
	create-or-update-no-deref <ref> <newvalue> [<oldvalue>]
        
An old value of 0{40} would mean "I should be the one creating; if
somebody else created it while I was preparing this request, please
fail".
Similarly for delete:
	delete <ref> [<oldvalue>]
        delete-no-deref <ref> [<oldvalue>]
Also how would one set the reflog message for the proposed update?
Previous: Brad KingNext: Brad King
Message 80 of 106 in “Multiple simultaneously locked ref updates”
  1. 0/7 Multiple simultaneously locked ref updatesBrad King, Aug 29, 2013
  2. 1/7 reset: rename update_refs to reset_refsBrad King, Aug 29, 2013
  3. Junio C HamanoAug 29, 2013
  4. Brad KingAug 29, 2013
  5. 2/7 refs: report ref type from lock_any_ref_for_updateBrad King, Aug 29, 2013
  6. Junio C HamanoAug 29, 2013
  7. Brad KingAug 29, 2013
  8. 3/7 refs: factor update_ref steps into helpersBrad King, Aug 29, 2013
  9. 4/7 refs: factor delete_ref loose ref step into a helperBrad King, Aug 29, 2013
  10. Junio C HamanoAug 29, 2013
  11. Brad KingAug 29, 2013
  12. 5/7 refs: add function to repack without multiple refsBrad King, Aug 29, 2013
  13. Junio C HamanoAug 29, 2013
  14. Brad KingAug 29, 2013
  15. 6/7 refs: add update_refs for multiple simultaneous updatesBrad King, Aug 29, 2013
  16. Junio C HamanoAug 29, 2013
  17. Brad KingAug 29, 2013
  18. Junio C HamanoAug 29, 2013
  19. Brad KingAug 29, 2013
  20. Brad KingAug 29, 2013
  21. 7/7 update-ref: support multiple simultaneous updatesBrad King, Aug 29, 2013
  22. Junio C HamanoAug 29, 2013
  23. Brad KingAug 29, 2013
  24. Martin FickAug 29, 2013
  25. Brad KingAug 29, 2013
  26. Junio C HamanoAug 29, 2013
  27. Brad KingAug 29, 2013
  28. Junio C HamanoAug 29, 2013
  29. Brad KingAug 29, 2013
  30. 0/8 Multiple simultaneously locked ref updatesBrad King, Aug 30, 2013
  31. 1/8 reset: rename update_refs to reset_refsBrad King, Aug 30, 2013
  32. 2/8 refs: report ref type from lock_any_ref_for_updateBrad King, Aug 30, 2013
  33. 3/8 refs: factor update_ref steps into helpersBrad King, Aug 30, 2013
  34. Junio C HamanoSep 1, 2013
  35. Brad KingSep 2, 2013
  36. 4/8 refs: factor delete_ref loose ref step into a helperBrad King, Aug 30, 2013
  37. Michael HaggertyAug 31, 2013
  38. Brad KingSep 2, 2013
  39. 5/8 refs: add function to repack without multiple refsBrad King, Aug 30, 2013
  40. 6/8 refs: add update_refs for multiple simultaneous updatesBrad King, Aug 30, 2013
  41. Michael HaggertyAug 31, 2013
  42. Brad KingSep 2, 2013
  43. Junio C HamanoSep 1, 2013
  44. Brad KingSep 2, 2013
  45. Michael HaggertySep 3, 2013
  46. Brad KingSep 3, 2013
  47. 7/8 update-ref: support multiple simultaneous updatesBrad King, Aug 30, 2013
  48. Junio C HamanoAug 30, 2013
  49. Brad KingSep 2, 2013
  50. Michael HaggertyAug 31, 2013
  51. Brad KingSep 2, 2013
  52. 8/8 update-ref: add test cases covering --stdin signatureBrad King, Aug 30, 2013
  53. Eric SunshineSep 1, 2013
  54. Brad KingSep 2, 2013
  55. Michael HaggertyAug 31, 2013
  56. 0/8 Multiple simultaneously locked ref updatesBrad King, Sep 2, 2013
  57. 1/8 reset: rename update_refs to reset_refsBrad King, Sep 2, 2013
  58. 2/8 refs: report ref type from lock_any_ref_for_updateBrad King, Sep 2, 2013
  59. 3/8 refs: factor update_ref steps into helpersBrad King, Sep 2, 2013
  60. 4/8 refs: factor delete_ref loose ref step into a helperBrad King, Sep 2, 2013
  61. 5/8 refs: add function to repack without multiple refsBrad King, Sep 2, 2013
  62. 6/8 refs: add update_refs for multiple simultaneous updatesBrad King, Sep 2, 2013
  63. 7/8 update-ref: support multiple simultaneous updatesBrad King, Sep 2, 2013
  64. Brad KingSep 2, 2013
  65. 8/8 update-ref: add test cases covering --stdin signatureBrad King, Sep 2, 2013
  66. Eric SunshineSep 3, 2013
  67. Brad KingSep 3, 2013
  68. 0/8 Multiple simultaneously locked ref updatesBrad King, Sep 4, 2013
  69. 1/8 reset: rename update_refs to reset_refsBrad King, Sep 4, 2013
  70. 2/8 refs: report ref type from lock_any_ref_for_updateBrad King, Sep 4, 2013
  71. 3/8 refs: factor update_ref steps into helpersBrad King, Sep 4, 2013
  72. 4/8 refs: factor delete_ref loose ref step into a helperBrad King, Sep 4, 2013
  73. 5/8 refs: add function to repack without multiple refsBrad King, Sep 4, 2013
  74. 6/8 refs: add update_refs for multiple simultaneous updatesBrad King, Sep 4, 2013
  75. 7/8 update-ref: support multiple simultaneous updatesBrad King, Sep 4, 2013
  76. Junio C HamanoSep 4, 2013
  77. Brad KingSep 4, 2013
  78. Junio C HamanoSep 4, 2013
  79. Brad KingSep 5, 2013
  80. Junio C HamanoSep 5, 2013
  81. Brad KingSep 5, 2013
  82. Junio C HamanoSep 4, 2013
  83. Brad KingSep 4, 2013
  84. 8/8 update-ref: add test cases covering --stdin signatureBrad King, Sep 4, 2013
  85. 0/8 Multiple simultaneously locked ref updatesBrad King, Sep 9, 2013
  86. 7/8 update-ref: support multiple simultaneous updatesBrad King, Sep 9, 2013
  87. 8/8 update-ref: add test cases covering --stdin signatureBrad King, Sep 9, 2013
  88. 0/8 Multiple simultaneously locked ref updatesBrad King, Sep 10, 2013
  89. 1/8 reset: rename update_refs to reset_refsBrad King, Sep 10, 2013
  90. Ramkumar RamachandraSep 10, 2013
  91. 2/8 refs: report ref type from lock_any_ref_for_updateBrad King, Sep 10, 2013
  92. 3/8 refs: factor update_ref steps into helpersBrad King, Sep 10, 2013
  93. 4/8 refs: factor delete_ref loose ref step into a helperBrad King, Sep 10, 2013
  94. 5/8 refs: add function to repack without multiple refsBrad King, Sep 10, 2013
  95. 6/8 refs: add update_refs for multiple simultaneous updatesBrad King, Sep 10, 2013
  96. 7/8 update-ref: support multiple simultaneous updatesBrad King, Sep 10, 2013
  97. Eric SunshineSep 10, 2013
  98. Brad KingSep 11, 2013
  99. Eric SunshineSep 11, 2013
  100. 8/8 update-ref: add test cases covering --stdin signatureBrad King, Sep 10, 2013
  101. Eric SunshineSep 10, 2013
  102. Junio C HamanoSep 10, 2013
  103. 8/8 update-ref: add test cases covering --stdin signatureBrad King, Sep 11, 2013
  104. Junio C HamanoSep 10, 2013
  105. Brad KingSep 10, 2013
  106. Junio C HamanoSep 10, 2013

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.