Re: [PATCH v3 19/27] refs: add a concept of a reference transaction

2014-04-15 Thread Junio C Hamano
Michael Haggerty writes: > In retrospect, you might have been objecting more to the misleading > docstring than to the behavior as implemented at the time. Yeah, I was reacting to the comment that said create can delete ;-) > The > docstring implied that create could actually be used to delet

Re: [PATCH v3 19/27] refs: add a concept of a reference transaction

2014-04-14 Thread Michael Haggerty
On 04/14/2014 11:25 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I forgot to confirm that the callers *do* verify that they don't pass >> incorrect values to ref_transaction_create() and >> ref_transaction_delete(). But if they wouldn't, then die("BUG:") would >> not be appropriate

Re: [PATCH v3 19/27] refs: add a concept of a reference transaction

2014-04-14 Thread Junio C Hamano
Michael Haggerty writes: > I forgot to confirm that the callers *do* verify that they don't pass > incorrect values to ref_transaction_create() and > ref_transaction_delete(). But if they wouldn't, then die("BUG:") would > not be appropriate either, would it? It would have to be die("you silly

Re: [PATCH v3 19/27] refs: add a concept of a reference transaction

2014-04-14 Thread Michael Haggerty
On 04/07/2014 09:13 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> +void ref_transaction_create(struct ref_transaction *transaction, >> +const char *refname, >> +unsigned char *new_sha1, >> +int flags) >> +{ >> +

Re: [PATCH v3 19/27] refs: add a concept of a reference transaction

2014-04-07 Thread Junio C Hamano
Michael Haggerty writes: > +void ref_transaction_create(struct ref_transaction *transaction, > + const char *refname, > + unsigned char *new_sha1, > + int flags) > +{ > + struct ref_update *update = add_update(transaction

[PATCH v3 19/27] refs: add a concept of a reference transaction

2014-04-07 Thread Michael Haggerty
Build out the API for dealing with a bunch of reference checks and changes within a transaction. Define an opaque ref_transaction type that is managed entirely within refs.c. Introduce functions for beginning a transaction, adding updates to a transaction, and committing/rolling back a transactio