From: Junio C Hamano Date: Thu, 05 Sep 2013 21:23:52 GMT Subject: Re: [PATCH v4 7/8] update-ref: support multiple simultaneous updates Message-ID: In-Reply-To: <5228EA62.7030606@kitware.com> Brad King writes: > 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 SP LF > update SP SP [SP ] LF > delete SP [SP ] LF > verify SP [SP ] LF > option SP LF > > Quote fields containing whitespace as if they were strings in C source > code. Alternatively, use `-z` to specify commands without quoting: > > create SP NUL NUL > update SP NUL NUL [] NUL > delete SP NUL [] NUL > verify SP NUL [] NUL > option SP NUL That SP in '-z' format looks strange. Was there a reason why NUL was inappropriate? > Lines of any other format or a repeated produce an error. > Command meanings are: > > create:: > Create with only if it does not exist. > > update:: > Update to be , verifying if given. > Specify a zero to delete a ref and/or a zero > to make sure that a ref does not exist. > > delete:: > Delete , verifying if given. > > verify:: > Verify against but do not change it. If > 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 option --no-deref update HEAD 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 [] create-or-update-no-deref [] 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 [] delete-no-deref [] Also how would one set the reflog message for the proposed update?