From: Junio C Hamano <gitster@pobox.com>
To: Shubham Kanodia <shubham.kanodia10@gmail.com>
Cc: Patrick Steinhardt <ps@pks.im>,
git@vger.kernel.org, Derrick Stolee <stolee@gmail.com>
Subject: Re: Consider adding pruning of refs to git maintenance
Date: Sun, 22 Dec 2024 20:21:27 -0800 [thread overview]
Message-ID: <xmqqwmfr112w.fsf@gitster.g> (raw)
In-Reply-To: <CAG=Um+2cdMcys2x492_i47-qdvx5aJ7k6r=xSH5a3JZtMZBEZw@mail.gmail.com> (Shubham Kanodia's message of "Sun, 22 Dec 2024 17:49:35 +0530")
Shubham Kanodia <shubham.kanodia10@gmail.com> writes:
> If you wanted to be able to do that, you'd probably need to do —
>
> ```
> git fetch origin new-ref-branch-from-remote
> --refmap=+refs/heads/new-ref-branch-from-remote:refs/remotes/origin/new-ref-branch-from-remote
> ```
>
> which is pretty awkward to type everytime.
Or have this in your .git/config
[remote "origin"]
fetch = +refs/heads/new-ref-branch-from-remote:refs/remotes/origin/new-ref-branch-from-remote
and run
$ git fetch origin new-ref-branch-from-remote
If you plan to do the same for more random branches, you could
instead do
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
as long as you promise that you never run "git fetch" without saying
which exact refs to fetch. I wonder if it helps to introduce a new
configuration remote.*.fetchmap
[remote "origin"]
fetchmap = +refs/heads/*:refs/remotes/origin/*
that only talks about how the mapping goes without saying what gets
fetched by default, so that the lack of remote.origin.fetch would
cause
$ git fetch origin
$ git fetch
not to grab everything (like when you had the same specification as
the value of remote.origin.fetch instead), but allows you to map
whatever you grab from there when you did
$ git fetch origin foo bar
If the glob pattern given by the fetchmap participated in how
fetch.prune behaves (i.e. I see refs/remotes/origin/baz here, but
while trying to fetch refs/heads/{foo,bar}, I notice that they no
longer advertise refs/heads/baz---let me prune that stale one),
that would make it much simpler.
> Now to come back from this little digression, for now —
> - We ask users to set both `fetch.prune` and `fetch.pruneTags` to true
> (so that if a third party tool does do something, the damage is
> limited and they don't have an ever-growing list of refs)
Good.
> - Setup this job that cleans stale remote refs on a periodic basis,
> which means that their ref counts heal over time (if they configure
> all third party tools right)
OK. And a scheduled task would make this part better.
next prev parent reply other threads:[~2024-12-23 4:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 12:33 Consider adding pruning of refs to git maintenance Shubham Kanodia
2024-12-17 7:21 ` Patrick Steinhardt
2024-12-17 7:41 ` Junio C Hamano
2024-12-17 11:21 ` Shubham Kanodia
2024-12-17 11:24 ` Shubham Kanodia
2024-12-17 19:56 ` Junio C Hamano
2024-12-18 8:30 ` Shubham Kanodia
2024-12-18 15:35 ` Junio C Hamano
2024-12-22 12:19 ` Shubham Kanodia
2024-12-23 4:21 ` Junio C Hamano [this message]
2024-12-23 9:30 ` Shubham Kanodia
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=xmqqwmfr112w.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
--cc=shubham.kanodia10@gmail.com \
--cc=stolee@gmail.com \
/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).