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 23, 2014, 17:09 UTC
Message-ID
<xmqq38g0l8we.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAEef6WyXGXAdm_DkzNsuLgeFFpQsxvTiuJbK3ypc8-Cz2qD_KQ@mail.gmail.com>
Jens Lindström <jl@opera.com> writes:
> Removing the remote configuration (I assume you mean the
> "remote.<name>" section from .git/config) last in 'remote rm' would be
> a bit better I think.  Especially ...
Yes, that is exactly why I suggested it ;-)
> Doing the repacking first and then run through and delete loose refs
> and ref logs leads to a smaller and nicer patch as well ...

Hmph, that would be a bonus, then. I suggested it primarily as a correctness thing against an interrupted operation.

> One additional change was required in
> builtin/remote.c:remove_branches().  It used to pass in the expected
> SHA-1 of the ref to delete_ref(), which only works if the ref exists.
> If repack_without_refs() is called first, most refs won't exist,...

Why? A ref, before you start pruning or removing a remote, could be in one of these three states.

 (a) only loose refs/remotes/them/frotz exists
 (b) both loose and packed refs/remotes/them/nitfol exist
 (c) only packed refs/remotes/them/xyzzy exists

And then you repack packed-refs file without these three refs. When you do so, you know that you would need to remove frotz and nitfol, and also you know you do not want to call delete_ref for xyzzy, no?

In other words, the problem you are describing in remove_branches(), that it wants to make sure that the ref-to-be-removed still points at the expected object, does not sound like it is doing anything inherently wrong---rather, it sounds like you didn't make necessary changes to the caller to make sure that you do not call delete_ref() on something you know you removed already.

Puzzled....
Previous: Jens LindströmNext: Jens Lindström
Message 6 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.