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

Re: [PATCH 0/8] Making reflog modifications part of the transactions API

From
Stefan Beller <sbeller@google.com>
Date
Dec 12, 2014, 20:51 UTC
Message-ID
<CAGZ79kZB9TbygBM47Ug5i_FeR1c5w9btbayNEU3D2PeObCwzMw@mail.gmail.com>
In-Reply-To
<548B150C.2090606@alum.mit.edu>
On Fri, Dec 12, 2014 at 8:17 AM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
Show 11 quoted lines
> On 12/06/2014 03:46 AM, Stefan Beller wrote:
>> This goes on top of Michaels series. The idea of this series is make the
>> reflogs being part of the transaction API, so it will be part of the contract
>> of transaction_commit to either commit all the changes or none at all.
>>
>> Currently when using the transaction API to change refs, also reflogs are changed.
>> But the changes to the reflogs just happen as a side effect and not as part of
>> the atomic part of changes we want to commit altogether.
>
> Would you please explain why this patch series is still needed if my
> "reflog_expire()" series is accepted?

If we can live with the fact that reflog and refs have different APIs then, we can probably drop that series. That series may also have performance issues, Junio pointed out. Most likely I'll look at the remaining 4 patch series from Ronnie, if I can put them on top of your series now.

Show 11 quoted lines
>
> reflog_expire() already has its own little transaction. Reflog
> expiration never needs to be combined with other reference changes, so
> there is no need for reflog expiration to be done via a ref_transaction.
>
> ref_transaction_commit() already updates the reflog if necessary when a
> reference is updated. That update is part of the containing
> ref_transaction, because it is locked by the lock on the reference
> itself at the beginning of the transaction and unlocked at the end of
> the transaction [1]. It can't fail in normal circumstances because the
> preconditions for the transaction have already been checked.
Show 7 quoted lines
>
> As far as I can tell, the only thing left to do is provide a substitute
> for log_ref_setup() a.k.a. create_reflog() that can be triggered within
> a transaction. In my opinion the easiest way to do that is to give
> ref_transaction_update()'s flag parameter an additional option,
> REF_CREATE_REFLOG, which forces the reference's reflog to be created if
> it does not already exist.

I already ported the patch which replaces log_ref_setup() by create_reflog() on top of your series-v1, but I refrained to send it out as Junio seems to dislike invasive patches[1] or possible merge conflicts so I was waiting for discussion on your patch series calm down and be merged to next at least.

Apart from that rename, I also looked into flagging REF_CREATE_REFLOG additionally. Though I run into problems there (test suite doesn't pass and I did not find the mistake for 5 hours :/)

>
> What am I missing?

I think the original plan of Ronnie was to have one and only one transaction API, which would be used for anything eventually (refs, reflogs, config, what have you) If we go for a relaxed version of that, we'd be fine.

Thanks, Stefan

[1] http://www.spinics.net/lists/git/msg243451.html
     The patch in question is not an invasive patch, but still touching places
     which may be touched currently by your series. So I just wanted
to wait a bit.
Previous: Michael HaggertyNext: ronnie sahlberg
Message 16 of 18 in “Making reflog modifications part of the transactions API”
  1. 0/8 Making reflog modifications part of the transactions APIStefan Beller, Dec 6, 2014
  2. 1/8 refs.c: let fprintf handle the formattingStefan Beller, Dec 6, 2014
  3. 2/8 refs.c: rename the transaction functionsStefan Beller, Dec 6, 2014
  4. Junio C HamanoDec 11, 2014
  5. Stefan BellerDec 11, 2014
  6. 3/8 refs.c: rename transaction.updates to transaction.ref_updatesStefan Beller, Dec 6, 2014
  7. 4/8 refs.c: add transaction function to append to the reflogStefan Beller, Dec 6, 2014
  8. Junio C HamanoDec 11, 2014
  9. 5/8 refs.c: add transaction function to delete the reflogStefan Beller, Dec 6, 2014
  10. 6/8 refs.c: use a reflog transaction when writing during expireStefan Beller, Dec 6, 2014
  11. 7/8 refs.c: rename log_ref_setup to create_reflogStefan Beller, Dec 6, 2014
  12. 8/8 refs.c: allow deleting refs with a broken sha1Stefan Beller, Dec 6, 2014
  13. Stefan BellerDec 8, 2014
  14. Jonathan NiederDec 8, 2014
  15. Michael HaggertyDec 12, 2014
  16. Stefan BellerDec 12, 2014
  17. ronnie sahlbergDec 12, 2014
  18. Michael HaggertyDec 14, 2014

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.