From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
"D. Ben Knoble" <ben.knoble@gmail.com>,
Emily Shaffer <nasamuffin@google.com>,
Christian Fredrik Johnsen <cfj@johnsen.no>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [Feature Request] Allow batch removal of remotes with 'git remote remove'
Date: Wed, 22 Jan 2025 08:23:09 -0800 [thread overview]
Message-ID: <xmqqed0uyg0i.fsf@gitster.g> (raw)
In-Reply-To: <20250122030832.GA3322144@coredump.intra.peff.net> (Jeff King's message of "Tue, 21 Jan 2025 22:08:32 -0500")
Jeff King <peff@peff.net> writes:
> On Wed, Jan 22, 2025 at 02:24:38AM +0000, brian m. carlson wrote:
>
>> Because `git remote remove` will remove remote-tracking branches and
>> their reflogs, we typically will want to do that all at once in a single
>> ref transaction, and hence in one command. Not doing so performs very
>> poorly (as does, notably `git remote rename`[0]) when all of the refs are
>> packed. If you have a large number of remotes to delete and a large
>> number of total refs, this will perform really badly indeed, since the
>> operation of rewriting the packed-refs file becomes quadratic.
>>
>> The removal of the remote-tracking branches is also the reason that
>> editing the config isn't sufficient, either.
>
> I think the config update is probably quadratic, too (in the number of
> remotes). Each one is going to rewrite the whole config file, minus its
> matching section. But a "remove" operation that took multiple remotes
> could do it all in a single pass.
>
> If somebody does implement "remote remove" that takes multiple names, I
> hope they'll refactor to do all of the operations in a single pass, and
> not just loop on builtin/remote.c:rm() internally.
>
> Probably git-config could stand to learn similar tricks, too. There is
> "--remove-section", but I don't think you can pass multiple sections
> (and it's likewise quadratic).
Thanks for bringing up the performance aspect and where the problem
lies in the current implementation.
next prev parent reply other threads:[~2025-01-22 16:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 23:06 [Feature Request] Allow batch removal of remotes with 'git remote remove' Christian Fredrik Johnsen
2025-01-21 21:10 ` Emily Shaffer
2025-01-21 21:32 ` D. Ben Knoble
2025-01-21 22:38 ` Junio C Hamano
2025-01-22 2:24 ` brian m. carlson
2025-01-22 3:08 ` Jeff King
2025-01-22 16:23 ` Junio C Hamano [this message]
2025-01-22 9:40 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqed0uyg0i.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=cfj@johnsen.no \
--cc=git@vger.kernel.org \
--cc=nasamuffin@google.com \
--cc=peff@peff.net \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).