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

Re: [PATCH v2 00/13] Use ref transactions from most callers

From
Ronnie Sahlberg <sahlberg@google.com>
Date
Apr 22, 2014, 22:43 UTC
Message-ID
<CAL=YDWmCLvQRe6CQddKQxhHXrPnTx7iXh=t0JQ_GhE2jvmgNhQ@mail.gmail.com>
In-Reply-To
<xmqqzjjd40q3.fsf@gitster.dls.corp.google.com>
I will look at this once i finish the next respin.
On Tue, Apr 22, 2014 at 12:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 49 quoted lines
> Ronnie Sahlberg <sahlberg@google.com> writes:
>
>> This patch series changes most of the places where the ref functions for
>> locking and writing refs to instead use the new ref transaction API. There
>> are still three more places where write_ref_sha1() is called from outside
>> of refs.c but those all will require more complex work and review so those
>> changes belong in a different patch series.
>>
>> Version 2:
>>  - Add a patch to ref_transaction_commit to make it honor onerr even if the
>>    error triggered in ref_Transaction_commit itself rather than in a call
>>    to other functions (that already honor onerr).
>>  - Add a patch to make the update_ref() helper function use transactions
>>    internally.
>>  - Change ref_transaction_update to die() instead of error() if we pass
>>    if a NULL old_sha1 but have have_old == true.
>>  - Change ref_transaction_create to die() instead of error() if new_sha1
>>    is false but we pass it a null_sha1.
>>  - Change ref_transaction_delete die() instead of error() if we pass
>>    if a NULL old_sha1 but have have_old == true.
>>  - Change several places to do  if(!transaction || ref_transaction_update()
>>    || ref_Transaction_commit()) die(generic-message) instead of checking each
>>    step separately and having a different message for each failure.
>>    Most users are likely not interested in what step of the transaction
>>    failed and only whether it failed or not.
>>  - Change commit.c to only pass a pointer to ref_transaction_update
>>    iff current_head is non-NULL.
>>    The previous patch used to compute a garbage pointer for
>>    current_head->object.sha1 and relied on the fact that ref_transaction_update
>>    would not try to dereference this pointer if !!current_head was 0.
>>  - Updated commit message for the walker_fetch change to try to justify why
>>    the change in locking semantics should not be harmful.
>
> Will queue, but when applied on top of mh/ref-transaction and tested
> standalone, it appears to fail test #14 of t5550-http-fetch-dumb.sh
> for me.
>
> It seems that the culprit is that this step:
>
>     git http-fetch -a -w heads/master-new $HEAD $(git config remote.origin.url) &&
>
> creates ".git/heads/master-new" when what it was asked to create was
> ".git/refs/heads/master-new".  Perhaps there is something fishy in
> the conversion in walker.c?  We used to do lock_ref_sha1() on
> "heads/master-new", which prepended "refs/" prefix before calling
> lock_ref_sha1_basic() that expects the full path from $GIT_DIR/, but
> ref_transaction_update(), which wants to see the full path, is still
> fed "heads/master-new" after this series.
>
Previous: Junio C Hamano
Message 19 of 19 in “Use ref transactions from most callers”
  1. 00/13 Use ref transactions from most callersRonnie Sahlberg, Apr 21, 2014
  2. 01/13 refs.c: constify the sha arguments for ref_transaction_create|delete|updateRonnie Sahlberg, Apr 21, 2014
  3. 02/13 refs.c: use a single exit path from transaction commit and handle onerrRonnie Sahlberg, Apr 21, 2014
  4. Junio C HamanoApr 22, 2014
  5. Ronnie SahlbergApr 22, 2014
  6. Junio C HamanoApr 22, 2014
  7. 03/13 refs.c: change ref_transaction_update() to do error checking and return statusRonnie Sahlberg, Apr 21, 2014
  8. 04/13 refs.c: change ref_transaction_create to do error checking and return statusRonnie Sahlberg, Apr 21, 2014
  9. 05/13 refs.c: ref_transaction_delete to check for error and return statusRonnie Sahlberg, Apr 21, 2014
  10. 06/13 tag.c: use ref transactions when doing updatesRonnie Sahlberg, Apr 21, 2014
  11. 07/13 replace.c: use the ref transaction functions for updatesRonnie Sahlberg, Apr 21, 2014
  12. 08/13 commit.c: use ref transactions for updatesRonnie Sahlberg, Apr 21, 2014
  13. 09/13 sequencer.c: use ref transactions for all ref updatesRonnie Sahlberg, Apr 21, 2014
  14. 10/13 fast-import.c: change update_branch to use ref transactionsRonnie Sahlberg, Apr 21, 2014
  15. 11/13 branch.c: use ref transaction for all ref updatesRonnie Sahlberg, Apr 21, 2014
  16. 12/13 walker.c: use ref transaction for ref updatesRonnie Sahlberg, Apr 21, 2014
  17. 13/13 refs.c: change update_ref to use a transactionRonnie Sahlberg, Apr 21, 2014
  18. Junio C HamanoApr 22, 2014
  19. Ronnie SahlbergApr 22, 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.