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

Re: [PATCH 1/1] delete multiple tags in a single transaction

From
Elijah Newren <newren@gmail.com>
Date
Aug 8, 2019, 18:15 UTC
Message-ID
<CABPp-BFH++aJinkzg+qsZDRN6R5-E8LPCG_u+udZLW6o0MGBug@mail.gmail.com>
In-Reply-To
<20190808035935.30023-1-phil.hord@gmail.com>
On Wed, Aug 7, 2019 at 9:11 PM Phil Hord <phil.hord@gmail.com> wrote:
Show 7 quoted lines
>
> From: Phil Hord <phil.hord@gmail.com>
>
> 'git tag -d' accepts one or more tag refs to delete, but each deletion
> is done by calling `delete_ref` on each argv. This is painfully slow
> when removing from packed refs. Use delete_refs instead so all the
> removals can be done inside a single transaction with a single write.
Nice, thanks for working on this.
> I have a repo with 24,000 tags, most of which are not useful to any
> developers. Having this many refs slows down many operations that
> would otherwise be very fast. Removing these tags when they've been
> accidentally fetched again takes about 30 minutes using delete_ref.

I also get really slow times on a repo with ~20,000 tags (though order ~3 minutes rather than ~30, probably due to having an SSD on this machine) -- but ONLY IF the refs are packed first (git pack-refs --all). If the refs are loose, it's relatively quick to delete a dozen thousand or so tags (order of a few seconds). It might be worth mentioning in the commit message that this only makes a significant difference in the case where the refs are packed.

>     git tag -l feature/* | xargs git tag -d
>
> Removing the same tags using delete_refs takes less than 5 seconds.

It appears this same bug also affects `git branch -d` when deleting lots of branches (or remote tracking branches) and they are all packed; could you apply the same fix there?

In constrast, it appears that `git update-ref --stdin` is fast
regardless of whether the refs are packed, e.g.
   git tag -l feature/* | sed -e 's%^%delete refs/tags/%' | git
update-ref --stdin
finishes quickly (order of a few seconds).
Previous: Martin ÅgrenNext: Phil Hord
Message 4 of 8 in “delete multiple tags in a single transaction”
  1. 1/1 delete multiple tags in a single transactionPhil Hord, Aug 8, 2019
  2. Martin ÅgrenAug 8, 2019
  3. t7004: check existence of correct tagMartin Ågren, Aug 8, 2019
  4. Elijah NewrenAug 8, 2019
  5. Phil HordAug 8, 2019
  6. Jeff KingAug 9, 2019
  7. Junio C HamanoAug 8, 2019
  8. Phil HordAug 8, 2019

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.