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

Re: [PATCH 1/2] remote: defer repacking packed-refs when deleting refs

From
Junio C Hamano <gitster@pobox.com>
Date
May 20, 2014, 20:29 UTC
Message-ID
<xmqqlhtwxkg9.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqtx8kxn7f.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> A bit safer way to organize might be to first create a list of the
> refs to be removed in-core, update packed-refs without these refs to
> be removed, and then finally remove the loose ones, but I haven't
> thought things through.

Perhaps a removal of remote can go in this order to be resistant against an abort-in-the-middle.

 * update packed-refs without the refs that came from the remote.
   - when interrupted before the new temporary file is renamed to
     the final, it would be a no-op.
   - when interrupted after the rename, only some refs that came
     from the remote may disappear.
 * remove the loose refs that came from the remote.
 * finally, remove the configuration related to the remote.

This order would let you interrupt "remote rm" without leaving the repository in a broken state. Before the final state, it may appear that you have some but not all remote-tracking refs from the remote in your repository, but you would not have any ref that point at an obsolete object. Running "remote rm" again, once it finishes, will give you the desired result.

A longer-term goal might be to have ref-transaction infrastructure clever enough to coalesce the "repack-without-these-refs" requests into one automatically without forcing the callers you are fixing care about these things, though. And such a transaction semantics may have to also cover the updating of configuration files.

Previous: Junio C HamanoNext: Jens Lindström
Message 4 of 16 in “remote: optimize rm/prune ref deletion”
  1. 0/2 remote: optimize rm/prune ref deletionJens Lindström, May 20, 2014
  2. 1/2 remote: defer repacking packed-refs when deleting refsJens Lindström, May 20, 2014
  3. Junio C HamanoMay 20, 2014
  4. Junio C HamanoMay 20, 2014
  5. Jens LindströmMay 23, 2014
  6. Junio C HamanoMay 23, 2014
  7. Jens LindströmMay 24, 2014
  8. Junio C HamanoMay 27, 2014
  9. 2/2 remote prune: optimize "dangling symref" check/warningJens Lindström, May 20, 2014
  10. 0/3 remote: optimize rm/prune ref deletionJens Lindström, May 23, 2014
  11. 1/3 remote rm: delete remote configuration as the lastJens Lindström, May 23, 2014
  12. Junio C HamanoMay 23, 2014
  13. 2/3 remote: repack packed-refs once when deleting multiple refsJens Lindström, May 23, 2014
  14. Junio C HamanoMay 23, 2014
  15. Junio C HamanoMay 23, 2014
  16. 3/3 remote prune: optimize "dangling symref" check/warningJens Lindström, May 23, 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.