Re: Fetch remote only if remote hasn't been fetched recently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Jun 2025 at 16:23, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> M Hickford <mirth.hickford@xxxxxxxxx> writes:
>
> > To support Git users with sporadic connectivity, might it be useful to
> > add an option to git fetch? Perhaps  `git fetch --offline` or `git
> > fetch --complete-prefetch`?
>
> "offline catch-up" is probably the phrase I would prefer to see in
> the documentation page to explain the concept of the operation than
> "complete prefetch".

That makes sense to me.

> In any case, to present it as a first-class option to end-users,
> there needs a lot more thinking and a bit of work need to go into
> the way "prefetch" works.  For example, the longhand I gave would
> work as a good solution only when the user _knows_ that the prefetch
> is more recent than their actual remote-tracking branches.  If
> refs/prefetch/remotes/R/* is older, then you wouldn't be bringing
> yourself closer to the present state of the remote at all with such
> a fetch, but as far as I know, a normal "git fetch R" from the
> remote R would not clear refs/prefetch/remotes/R/* when it
> completes.  There is no "last time we fetched from there" record
> kept anywhere in the repository either.  So offhand, you'd at least
> need to do these:
>
>  - teach "git fetch" that updates remote-tracking branches to remove
>    the corresponding ref in the refs/prefetch/ hierarchy;
>
>  - decide on what option name to use for this new operation and
>    document it;
>
>  - implement the option "git fetch --that-option nickname" to
>
>    - figure out the remote-tracking hierarchy for nickname and call
>      it R
>
>    - when refs/prefetch/remotes/R/* exists, do an
>
>      $ git fetch . "+refs/prefetch/remotes/R/*:refs/remotes/R/*"
>

Thanks Junio for your insight.

I shall leave this as a feature request, perhaps suitable for a
microproject #leftoverbits




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux